Open aleneapen opened 1 year ago
Hi @aleneapen. 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:
@magento give me 2.4-develop instance
- upcoming 2.4.x release@magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: 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.
Hi @engcom-Bravo. 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: :point_down:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Issue: Confirmed
once verification is complete. @magento give me 2.4-develop instance
Hi @aleneapen. Thank you for your request. I'm working on Magento instance for you.
Hi @aleneapen, here is your Magento Instance: https://f8fd22f80ea4faaa323e4d586df0fa8c.instances-prod.magento-community.engineering Admin access: https://f8fd22f80ea4faaa323e4d586df0fa8c.instances-prod.magento-community.engineering/admin_fdb3 Login: 8e65dffe Password: 68751eaaf747
@magento give me 2.4-develop instance
Hi @engcom-Bravo. Thank you for your request. I'm working on Magento instance for you.
Hi @engcom-Bravo, here is your Magento Instance: https://f8fd22f80ea4faaa323e4d586df0fa8c.instances-prod.magento-community.engineering Admin access: https://f8fd22f80ea4faaa323e4d586df0fa8c.instances-prod.magento-community.engineering/admin_53ef Login: 301ba636 Password: 20786fa664a5
Hi @aleneapen,
Thank you for reporting and collaboration.
Verified the issue on Magento 2.4-develop instance and the issue is not reproducible.Kindly refer the screenshots.
Steps to reproduce
Create the first cart price rule: Rule Information: Active: Yes Coupon: Specific Coupon Coupon Code: 50OFF Priority: 0 Condition: None Actions Apply: Percent of product price discount Discount Amount: 50% Maximum Qty Discount is Applied To: 0 Discount Qty Step (Buy X): 0 Apply to Shipping Amount: No Discard subsequent rules: Yes
Create the second cart price rule Rule Information: Active: Yes Coupon: No Coupon Priority: 1 Condition: If trial SKU is in cart Actions Apply: Percent of product price discount Discount Amount: 100% Maximum Qty Discount is Applied To: 1 Discount Qty Step (Buy X): 0 Apply to Shipping Amount: Yes Discard subsequent rules: Yes
Add to cart 2 products: first product = trial SKU, second product = non-trial SKU. The second rule applies Trial SKU price: $20 Non-trial SKU price: $100 Shipping: $10 Subtotal: $130 Discount: -$30.00
It is working fine here.
Apply Discount Code: 50OFF The first rule is applied correctly but the second rule's shipping discount is applied incorrectly Trial SKU price: $20 Non-trial SKU price: $100 Shipping: $10 Subtotal: $130 Discount: -$70
Here discount $70 is getting applied Could you please elaborate how discount should be $60.
Thanks.
Hi @engcom-Bravo, here is my thinking: the discount should be $60 because the second rule shipping discount shouldn't apply.
Since the first rule had priority = 0 and Discard subsequent rules: Yes, and Apply to shipping Amount = No so the second rule shouldn't apply.
Is that the intended behaviour?
Hi @aleneapen,
Thanks for your update.
Here i have deactivated the second price rule it is working fine here.Discount is $60
As per the document https://experienceleague.adobe.com/docs/commerce-admin/marketing/promotions/cart-rules/price-rules-cart-create.html?lang=en#step-1%3A-add-a-rule
The Priority setting is important when two cart rules/coupon codes are valid for the same product at the same time. The rule with the highest Priority setting (1 being the highest) controls the cart action
When we are applying both cart price rules
As per devdocs second cart price rule should apply to product with 20$ with having priority 1 in that case total discount will be above $70 because it will give 100% discount.could you please check document and please let us know if we are missing anything and elaboarte the steps.
Thanks.
Hi @engcom-Bravo, The documentation is unclear. 0 is higher priority than 1.
lower number in priority field = higher priority. 0 is the highest priority
Also see this comment on a similar issue: https://github.com/magento/magento2/issues/27202#issuecomment-627331528
So technically, the second rule (with priority = 1) shouldn't apply at all in our test case.
Hi @aleneapen,
Thanks for your update.
Verified the issue on Magento 2.4-develop instance and the issue is reproducible.kindly refer the screenshots.
Discount is applied as $70.As per the documentation https://experienceleague.adobe.com/docs/commerce-admin/marketing/promotions/cart-rules/price-rules-cart-create.html?lang=en#step-1%3A-add-a-rule cart price rule having high priority is should control action.Here second rule should not apply.
Hence Confirming the issue.
Thanks.
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-9612 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-Bravo. Thank you for verifying the issue.
Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
Preconditions and environment
Steps to reproduce
Create the first cart price rule: Rule Information: Active: Yes Coupon: Specific Coupon Coupon Code: 50OFF Priority: 0 Condition: None Actions Apply: Percent of product price discount Discount Amount: 50% Maximum Qty Discount is Applied To: 0 Discount Qty Step (Buy X): 0 Apply to Shipping Amount: No Discard subsequent rules: Yes
Create the second cart price rule Rule Information: Active: Yes Coupon: No Coupon Priority: 1 Condition: If trial SKU is in cart Actions Apply: Percent of product price discount Discount Amount: 100% Maximum Qty Discount is Applied To: 1 Discount Qty Step (Buy X): 0 Apply to Shipping Amount: Yes Discard subsequent rules: Yes
Add to cart 2 products: first product = trial SKU, second product = non-trial SKU. The second rule applies Trial SKU price: $20 Non-trial SKU price: $100 Shipping: $10 Subtotal: $130 Discount: -$30.00
Apply Discount Code: 50OFF The first rule is applied correctly but the second rule's shipping discount is applied incorrectly Trial SKU price: $20 Non-trial SKU price: $100 Shipping: $10 Subtotal: $130 Discount: -$70
Expected result
Discount in step 4 should be $60
Actual result
Discount in step 4 is incorrect: $70
Additional information
This seems to be a problem in Magento\SalesRule\Model\Validator::processShippingAmount
Changing lines 334
to
seems to fix the issue.
Release note
Discard subsequent cart price rules for shipping amount discounts
Triage and priority