magento2
magento2 copied to clipboard
Cart price rule created for logged in user incorrectly gets applied for not logged in user
Preconditions (*)
- Magento dev-2.4-develop
Description (*)
There is a cart price rule that applies only to logged-in users, for example, a 5% discount. When the user is logged in and adds a product to the cart, the cart price rule will be applied. After that, the user is logged out automatically because the cookie lifetime has expired. When the user visits the shop again, the product is still present in the cart, and the cart price rule is still applied to the product, even though the user is not logged in.
Screenshot-1:
Screenshot-2:
Screenshot-3:
Screenshot-4:
Steps to reproduce (*)
- In Marketing -> Cart Price Rules add rule for log in customers (select general customer group), for example 5% discount.(Shown in Screenshot - 1)
- In Stores -> Configuration ->Customers -> Persistent Shopping Cart -> set the following configuration: Enable Persistence - Yes , Clear Persistence on Sign Out – Yes (Shown in Screenshot - 2)
- In Stores -> Configuration -> General -> Web ->Default Cookie Settings ->Cookie Lifetime (For example 60 seconds) (Shown in Screenshot - 3)
- In the shop, create a customer account and add a product to the cart. At this time, the cart price rule will be applied, and the user will get a discount on the product.
- After that user will be log out according to the cookie lifetime (step – 3)
- Open the shop, at this time user is not log in into the shop, but user can still see the product into the cart with applied discount.(Shown in Screenshot - 4)
Expected result (*)
When user is logged out cart price rule should not applied and cart should be empty.
Actual result (*)
Here user is logged out but still we can see the product in the cart and cart price rule is still applied.
Hi @dhruvi-prajapat1. 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- 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.
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:
- [ ] 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: XXXXXlabel to the ticket, indicating the functional areas it may be related to. - [ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced 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: Confirmedonce verification is complete. - [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hi @engcom-Dash. 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:
-
- Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
-
- Verify that issue has a meaningful description and provides enough information to reproduce the issue.
-
- Add
Area: XXXXXlabel to the ticket, indicating the functional areas it may be related to.
- Add
-
- Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced 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!
- Verify that the issue is reproducible on
- Join Magento Community Engineering Slack and ask your questions in #github channel.
@magento give me 2.4-develop instance
Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.
Hi @engcom-Dash, here is your Magento Instance: https://7c95f6cbfcda5196c011877c84eafb44.instances-prod.magento-community.engineering Admin access: https://7c95f6cbfcda5196c011877c84eafb44.instances-prod.magento-community.engineering/admin_c3cd Login: 9223c5f1 Password: cd0a0c999d86
Hi @dhruvi-prajapat1
Thanks for reporting and collaboration.
Verified the issue on Magento 2.4 dev instance and the issue is reproducable.
Cart price rule created for logged in user incorrectly gets applied for not logged in user . Hence, confirming the issue.
Steps to reproduce (*)
- In Marketing -> Cart Price Rules add rule for log in customers (select general customer group), for example 5% discount.
- In Stores -> Configuration ->Customers -> Persistent Shopping Cart -> set the following configuration: Enable Persistence - Yes , Clear Persistence on Sign Out – Yes
- In Stores -> Configuration -> General -> Web ->Default Cookie Settings ->Cookie Lifetime (For example 60 seconds)
- In the shop, create a customer account and add a product to the cart. At this time, the cart price rule will be applied, and the user will get a discount on the product.
- After that user will be log out according to the cookie lifetime (step – 3)
- Open the shop, at this time user is not log in into the shop, but user can still see the product into the cart with applied discount.
Please refer the attached screenshots.
Cart price rule:
Setting cookie lifetime:
Loggedin customer:
Logged out customer :
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-12541 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-Dash. Thank you for verifying the issue.
Issue Available: @engcom-Dash, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
@magento i'm working on this
Hi @rogerdz,
Internal team has started to work on it
Thanks.
Hello,
As I can see this issue got fixed in the scope of the internal Jira ticket AC-12541 by the internal team Related commits:https://github.com/search?q=repo%3Amagento%2Fmagento2+AC-12541&type=commits
Based on the Jira ticket, the target version is 2.4.8-beta2.
Thanks