Skip to content

Bundle Product discounts not saved to quote_item table #35165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
hcmlopes opened this issue Mar 4, 2022 · 15 comments
Open
1 task done

Bundle Product discounts not saved to quote_item table #35165

hcmlopes opened this issue Mar 4, 2022 · 15 comments
Labels
Area: Cart & Checkout Component: Api Use with concrete module component label E.g. "Component: Api" + "Catalog" feature request Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: ready for grooming

Comments

@hcmlopes
Copy link

hcmlopes commented Mar 4, 2022

Preconditions (*)

  1. Magento 2.4.3-p1

Steps to reproduce (*)

  1. Create Cart Price Rule for 10%
  2. Add Bundle Product to cart
  3. Check column row_total_with_discount, discount_amount, base_discount_amount, discount_percent in database table quote_item
  4. Check API /rest/<STORE_CODE>/V1/guest-carts/<CART_ID>/totals

Expected result (*)

  1. The fields are being calculated properly and stored in the database and therefore are properly returned via API

Actual result (*)

image

Additional Info (*)

  1. Database shows rule 14 should be applied which in this case applies 10%. This can be seen in the checkout where the discount does apply as expected.
    image
  2. Partially related issue row_total_with_discount not calculated #34288

Severity assessment

  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
@m2-assistant
Copy link

m2-assistant bot commented Mar 4, 2022

Hi @hcmlopes. Thank you for your report.
To speed up processing of this issue, make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@m2-assistant
Copy link

m2-assistant bot commented Mar 7, 2022

Hi @engcom-Delta. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Delta
Copy link
Contributor

Hi @hcmlopes,
Thank you for raising an issue .We tried to reproduce the issue on magento 2.4 Develop but we could not find out the endpoint , we have referred dev doc # [https://devdocs.magento.com/guides/v2.4/rest/tutorials/orders/order-add-items.html
unfortunately it was not available . Please help us to replicate the issue.

Thanks

@engcom-Delta engcom-Delta added Issue: needs update Additional information is require, waiting for response and removed Issue: ready for confirmation labels Mar 8, 2022
@hcmlopes
Copy link
Author

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @hcmlopes. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@hcmlopes
Copy link
Author

@engcom-Delta
Steps to reproduce

  1. Request Magento instance
  2. Generate a new guest cart by making a POST request to /rest/default/V1/guest-carts
  3. Use Cart ID received and make POST request to /rest/default/V1/guest-carts/:cartId/items
Payload
{
  "cartItem": {
    "sku": "WS12-M-Orange",
    "qty": 1,
    "quote_id": "{{cartId}}"
  }
}
  1. Use Cart ID received and make POST request to /rest/default/V1/guest-carts/:cartId/items
Payload

Make sure to replace {{cartId}} with the cart ID received from Step 2

{
  "cartItem": {
    "sku": "24-WG080",
    "qty": 4,
    "quote_id": "{{cartId}}",
    "product_option": {
      "extension_attributes": {
        "bundle_options": [
          {
            "option_id": 1,
            "option_qty": 1,
            "option_selections": [2]
          },
          {
            "option_id": 2,
            "option_qty": 1,
            "option_selections": [4]
          },
          {
            "option_id": 3,
            "option_qty": 1,
            "option_selections": [6]
          },
          {
            "option_id": 4,
            "option_qty": 1,
            "option_selections": [8]
          }
        ]
      }
    }
  }
}
  1. Make GET request to /rest/default/V1/guest-carts/:cartId/totals
    Result
{
    "grand_total": 198.4,
    "base_grand_total": 198.4,
    "subtotal": 316,
    "base_subtotal": 316,
    "discount_amount": -117.6,
    "base_discount_amount": -117.6,
    "subtotal_with_discount": 198.4,
    "base_subtotal_with_discount": 198.4,
    "shipping_amount": 0,
    "base_shipping_amount": 0,
    "shipping_discount_amount": 0,
    "base_shipping_discount_amount": 0,
    "tax_amount": 0,
    "base_tax_amount": 0,
    "weee_tax_applied_amount": null,
    "shipping_tax_amount": 0,
    "base_shipping_tax_amount": 0,
    "subtotal_incl_tax": 316,
    "shipping_incl_tax": 0,
    "base_shipping_incl_tax": 0,
    "base_currency_code": "USD",
    "quote_currency_code": "USD",
    "items_qty": 6,
    "items": [
        {
            "item_id": 10,
            "price": 68,
            "base_price": 68,
            "qty": 4,
            "row_total": 272,
            "base_row_total": 272,
            "row_total_with_discount": 0,
            "tax_amount": 0,
            "base_tax_amount": 0,
            "discount_amount": 0,
            "base_discount_amount": 0,
            "discount_percent": 0,
            "price_incl_tax": 68,
            "base_price_incl_tax": 68,
            "row_total_incl_tax": 272,
            "base_row_total_incl_tax": 272,
            "options": "[{\"value\":\"1 x Sprite Stasis Ball 65 cm <span class=\\\"price\\\">$27.00<\\/span>\",\"label\":\"Sprite Stasis Ball\"},{\"value\":\"1 x Sprite Foam Yoga Brick <span class=\\\"price\\\">$5.00<\\/span>\",\"label\":\"Sprite Foam Yoga Brick\"},{\"value\":\"1 x Sprite Yoga Strap 8 foot <span class=\\\"price\\\">$17.00<\\/span>\",\"label\":\"Sprite Yoga Strap\"},{\"value\":\"1 x Sprite Foam Roller <span class=\\\"price\\\">$19.00<\\/span>\",\"label\":\"Sprite Foam Roller\"}]",
            "weee_tax_applied_amount": null,
            "weee_tax_applied": null,
            "name": "Sprite Yoga Companion Kit"
        },
        {
            "item_id": 15,
            "price": 22,
            "base_price": 22,
            "qty": 2,
            "row_total": 44,
            "base_row_total": 44,
            "row_total_with_discount": 0,
            "tax_amount": 0,
            "base_tax_amount": 0,
            "tax_percent": 0,
            "discount_amount": 8.8,
            "base_discount_amount": 8.8,
            "discount_percent": 20,
            "price_incl_tax": 22,
            "base_price_incl_tax": 22,
            "row_total_incl_tax": 44,
            "base_row_total_incl_tax": 44,
            "options": "[]",
            "weee_tax_applied_amount": null,
            "weee_tax_applied": null,
            "name": "Radiant Tee-M-Orange"
        }
    ],
    "total_segments": [
        {
            "code": "subtotal",
            "title": "Subtotal",
            "value": 316
        },
        {
            "code": "discount",
            "title": "Discount",
            "value": -117.6
        },
        {
            "code": "shipping",
            "title": "Shipping & Handling",
            "value": 0
        },
        {
            "code": "tax",
            "title": "Tax",
            "value": 0,
            "extension_attributes": {
                "tax_grandtotal_details": []
            }
        },
        {
            "code": "grand_total",
            "title": "Grand Total",
            "value": 198.4,
            "area": "footer"
        }
    ]
}

Expected result

Both items should have their respective discount information. As you can see the bundle product, item_id: 10 in the example, does not have discount_amount, base_discount_amount, percecnt_discount, row_total_with_discount which would be used to properly display line item rows

@engcom-Delta
Copy link
Contributor

engcom-Delta commented Mar 22, 2022

Hi @hcmlopes ,

Thanks for providing detailed steps to replicate , after following the steps issue is reproducible.
We found that discount_amount, base_discount_amount, percecnt_discount, row_total_with_discount values are missing Hence issue has been confirmed.

Results:

Screenshot 2022-03-22 at 12 43 38 PM

Screenshot 2022-03-22 at 12 45 29 PM

@engcom-Delta engcom-Delta reopened this Mar 22, 2022
@m2-community-project m2-community-project bot added Issue: ready for confirmation and removed Issue: needs update Additional information is require, waiting for response labels Mar 22, 2022
@engcom-Delta engcom-Delta added Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch and removed Issue: ready for confirmation labels Mar 22, 2022
@engcom-Delta engcom-Delta added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed and removed Issue: ready for confirmation labels Mar 22, 2022
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.magento.com/browse/AC-2679 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Mar 22, 2022

✅ Confirmed by @engcom-Delta. Thank you for verifying the issue.
Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@engcom-Hotel engcom-Hotel added the Priority: P3 May be fixed according to the position in the backlog. label Mar 22, 2022
@engcom-Delta
Copy link
Contributor

Hi @hcmlopes ,
We had a confirmation from PO this is not a bug or missed requirement, the intended functionality on the dynamic bundle was to NOT calculate its parent and the luma cart was ignoring those fields in case of bundle.
Hence we are closing it.

Thanks

@github-jira-sync-bot github-jira-sync-bot added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. and removed Priority: P3 May be fixed according to the position in the backlog. labels May 24, 2022
@engcom-Hotel
Copy link
Contributor

Hello @hcmlopes,

As per discussion internally we reopening this ticket as a feature request.

Thanks

@engcom-Hotel engcom-Hotel reopened this May 26, 2022
@m2-community-project m2-community-project bot removed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Progress: done labels May 26, 2022
@engcom-Hotel engcom-Hotel reopened this May 26, 2022
@sebfie
Copy link

sebfie commented Sep 7, 2022

Hello,
Can we have a patch for that or something to fix it without waiting new version?

@engcom-Hotel engcom-Hotel moved this to Ready for Grooming in Feature Requests Backlog Aug 19, 2024
@engcom-Delta engcom-Delta added Component: Checkout Component: Api Use with concrete module component label E.g. "Component: Api" + "Catalog" and removed Component: Checkout labels Oct 7, 2024
@engcom-Delta
Copy link
Contributor

Hi @hcmlopes ,

Thanks for your reporting and collaboration.
We have re-verified the issue in latest 2.4-develop instance and the issue is reproducible.
Kindly refer the screenshots.

Steps to reproduce -

  1. Create Cart Price Rule for 10%
  2. Add Bundle Product to cart
  3. Check column row_total_with_discount, discount_amount, base_discount_amount, discount_percent in database table quote_item
  4. Check API /rest/<STORE_CODE>/V1/guest-carts/<CART_ID>/totals
    Observe discount information is not displaying for bundle product
    image
    image

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Cart & Checkout Component: Api Use with concrete module component label E.g. "Component: Api" + "Catalog" feature request Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: ready for grooming
Projects
Status: Ready for Grooming
Development

No branches or pull requests

5 participants