Skip to content
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

Percentage discount on tier price and catalog price rule calculated on original price without selected options. #38750

Open
1 of 5 tasks
mdkdev opened this issue May 23, 2024 · 9 comments
Assignees
Labels
Area: Product Component: Pricing Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: dev in progress Reported on 2.4.7 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@mdkdev
Copy link

mdkdev commented May 23, 2024

Preconditions and environment

  • Magento <= 2.4.7

Steps to reproduce

For a clear example, use the following numbers:

Product Price: 1000
Tier Price: 50% Discount
Custom Option Value: -500

  • Configure a simple product with a price (1000) and a custom option with at least two values. Set one of the price of the values to 0, and another one to a negative number (-500).
  • Set a tier price with a percentage discount (-50%)
  • Go to the frontend, and visit the product. Select the negative custom option value, and the qty that was set on the 50% tier price.

image

image

Expected result

The tier price discount is calculated on the price including the custom options. For example:

(1000 - 500) / 2 = 250

Where 1000 is the original product price, 500 is the negative custom option value and 2 is the 50% discount from the tier price.

Actual result

The tier price is calculated based on the original product price without the selected custom options.

(1000 - 500) - 500 = 0

Where 1000 is the original product price, 500 is the negative custom option value and the other 500 is 50% of the original product price (1000).

Additional information

Screencast:
https://github.com/magento/magento2/assets/6543944/41b32739-a861-40b8-8a21-19c562a48c03

Scenario:2

The same problem occurs when a catalog price rule is set to (for example) a specific customer group. The discount is then deducted from the original price, which means that the following example results in a 0,- total:

Original Product Price: 1000.00
Cart Price Rule: -50%
Custom Option Price: -500

Total Price: (1000 / 2) - 500 = 0.00

This should be a 50% discount on the configured product:

Total Price: (1000 - 500) / 2 = 250.00

magento_cart_price_rule_custom_options.mp4

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Copy link

m2-assistant bot commented May 23, 2024

Hi @mdkdev. Thank you for your report.
To speed up processing of this issue, 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:


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ 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.

Copy link

m2-assistant bot commented May 24, 2024

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).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas 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 engcom-Delta added the Reported on 2.4.7 Indicates original Magento version for the Issue report. label May 24, 2024
@engcom-Delta
Copy link
Contributor

engcom-Delta commented May 24, 2024

Hi @mdkdev ,

Verified the issue on latest 2.4.7 and 2.4-develop, it is reproducible.

Hence, Confirming the issue.

Steps to reproduce:-

1.Configure a simple product with a price 1000
2.Set a tier price with a percentage discount (50%)
3.Set custom option with at least two values, one of the price of the values to 0, and another one to a negative number -500.
4.Go to the frontend, and visit the product.
5.Select the negative custom option value, and the qty that was set on the 50% tier price.

Actual Result:

The tier price is calculated based on the original product price without the selected custom options.

(1000 - 500) - 500 = 0

Where 1000 is the original product price, 500 is the negative custom option value and the other 500 is 50% of the original product price (1000).

Screen.Recording.2024-05-24.at.2.mp4

@engcom-Delta engcom-Delta added Component: Pricing Area: Product 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 labels May 24, 2024
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Confirmed in Issue Confirmation and Triage Board May 24, 2024
@github-jira-sync-bot
Copy link

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

Copy link

m2-assistant bot commented May 24, 2024

✅ 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.

@mdkdev
Copy link
Author

mdkdev commented May 28, 2024

Hi @engcom-Delta,

Thank you for confirming the issue. The same problem occurs when a catalog price rule is set to (for example) a specific customer group. The discount is then deducted from the original price, which means that the following example results in a 0,- total:

Original Product Price: 1000.00
Cart Price Rule: -50%
Custom Option Price: -500

Total Price: (1000 / 2) - 500 = 0.00

This should be a 50% discount on the configured product:

Total Price: (1000 - 500) / 2 = 250.00

magento_cart_price_rule_custom_options.mp4

Should this be added to a new issue, or is this the right place?

Thank you.

@engcom-Charlie engcom-Charlie added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label May 28, 2024
@m2-community-project m2-community-project bot added this to Ready for Development in High Priority Backlog May 28, 2024
@engcom-Charlie engcom-Charlie added the Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. label May 28, 2024
@engcom-Charlie engcom-Charlie removed the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label May 28, 2024
@digitalrisedorset
Copy link
Contributor

@magento I am working on this

@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Jun 13, 2024
@engcom-Delta engcom-Delta changed the title Percentage discount on tier price calculated on original price without selected options. Percentage discount on tier price and catalog price rule calculated on original price without selected options. Jun 19, 2024
@engcom-Delta
Copy link
Contributor

engcom-Delta commented Jun 19, 2024

Hi @engcom-Delta,

Thank you for confirming the issue. The same problem occurs when a catalog price rule is set to (for example) a specific customer group. The discount is then deducted from the original price, which means that the following example results in a 0,- total:

Original Product Price: 1000.00 Cart Price Rule: -50% Custom Option Price: -500

Total Price: (1000 / 2) - 500 = 0.00

This should be a 50% discount on the configured product:

Total Price: (1000 - 500) / 2 = 250.00

magento_cart_price_rule_custom_options.mp4
Should this be added to a new issue, or is this the right place?

Thank you.

Hi @mdkdev ,

I have updated the main description and added the scenario in additional information.

Thanks,

@digitalrisedorset
Copy link
Contributor

digitalrisedorset commented Jun 20, 2024

Hi, I have looked into this issue. The problem is narrowed to 2 javascript files:

  • app/code/Magento/Catalog/view/base/web/js/price-options.js
  • app/code/Magento/Catalog/view/base/web/js/price-box.js
    Particularly, the method updateProductTierPrice in the price-box.js file calls updatePrice once the tier prices changes are applied
    And then the updatePrice method handles the custom options price changes.

My understanding is: we want to inverse this calculation. We want instead the custom option prices to be performed first and then the tier prices would be adjusted after.

These 2 files have their logic intertwined with their UI. Some event subscribers seem to interact from one price to another price type.. I would like enquire on possible documentation to gain awareness of design/architecture around the price calculation on the product detail page. Would we have a diagram to understand the flow with the prices data and the UI on the product page?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Product Component: Pricing Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: dev in progress Reported on 2.4.7 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
High Priority Backlog
  
Dev In Progress
Development

No branches or pull requests

5 participants