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

Parallel Requests to Add Same Product to Cart Result In Two Separate Items In The Cart #37847

Closed
github-jira-sync-bot opened this issue Aug 4, 2023 · 4 comments
Assignees
Labels
Evaluated 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: done Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.

Comments

@github-jira-sync-bot
Copy link

github-jira-sync-bot commented Aug 4, 2023

Short issue description

When the merchant send two parallel requests with adding the same configurable product to the cart, there are two separate items on the cart with the same product SKU.

Steps to reproduce

  1. Install the latest magento2 develop
  2. Create configurable with SKU "Test" and one simple "Test-A"
  3. Create new empty cart via graphql (substitute location with your magento URL)
curl --location 'http://mag24i1.local/graphql' \
--header 'Store: default' \
--header 'Content-Type: application/json' \
--data '{"query":"mutation{\n  createEmptyCart\n}","variables":{}}'
  1. Run two concurrent request to add the same product to the cart (change cartID and location for both requests)
curl --location 'http://mag24i1.local/graphql' --header 'Store: default'  --header 'Content-Type: application/json' --data '{"query":"mutation($cartId: String!, $preSku: String!, $preParentSku: String!) {\r\n addConfigurableProductsToCart(\r\n input: {\r\n cart*id: $cartId\r\n cart_items: <\r\n {\r\n parent_sku: $preParentSku\r\n data: {\r\n quantity: 1\r\n sku: $preSku\r\n }\r\n }\r\n ]\r\n }\r\n ) {\r\n cart {\r\n items {\r\n id\r\n product {\r\n name\r\n sku\r\n }\r\n   quantity\r\n \r\n prices {\r\n price {\r\n value\r\n currency\r\n }\r\n }\r\n ... on ConfigurableCartItem {\r\n configurable_options {\r\n option_label\r\n value_label\r\n }\r\n }\r\n }\r\n total_quantity\r\n prices {\r\n grand_total {\r\n value\r\n currency\r\n }\r\n discounts {\r\n amount {\r\n value\r\n currency\r\n }\r\n label\r\n }\r\n subtotal_excluding_tax {\r\n value\r\n currency\r\n }\r\n } \r\n }\r\n }\r\n}","variables":{"cartId":"oYunbzrAllixJvQjVXHoOinUp6C72KyX","preParentSku":"Test","preSku":"Test-A"}}' & curl --location 'http://mag24i1.local/graphql' --header 'Store: default' --header 'Content-Type: application/json' --data '{"query":"mutation($cartId: String!, $preSku: String!, $preParentSku: String!) {\r\n addConfigurableProductsToCart(\r\n input: {\r\n cart_id: $cartId\r\n cart_items: [\r\n {\r\n parent_sku: $preParentSku\r\n data: {\r\n quantity: 1\r\n sku: $preSku\r\n }\r\n }\r\n >\r\n }\r\n ) {\r\n cart {\r\n items {\r\n id\r\n product {\r\n name\r\n sku\r\n }\r\n   quantity\r\n \r\n prices {\r\n price {\r\n value\r\n currency\r\n }\r\n }\r\n ... on ConfigurableCartItem {\r\n configurable_options {\r\n option_label\r\n value_label\r\n }\r\n }\r\n }\r\n total_quantity\r\n prices {\r\n grand_total {\r\n value\r\n currency\r\n }\r\n discounts {\r\n amount {\r\n value\r\n currency\r\n }\r\n label\r\n }\r\n subtotal_excluding*tax {\r\n value\r\n currency\r\n }\r\n } \r\n }\r\n }\r\n}","variables":{"cartId":"oYunbzrAllixJvQjVXHoOinUp6C72KyX","preParentSku":"Test","preSku":"Test-A"}}'
  1. Get the cart to see the items (change cartId and location)
curl --location 'http://mag24i1.local/graphql' \
--header 'Store: default' \
--header 'Content-Type: application/json' \
--data '{"query":"{\n  cart(cart_id: \"oYunbzrAllixJvQjVXHoOinUp6C72KyX\") {\n    items {\n      id\n      product {\n        name\n        sku\n      }\n      quantity\n    }\n\n  }\n}\n","variables":{}}'

Actual results

Item is listed twice with qtys = 1

Expected results

Item listed once with qty = 2

Additional information

N/A

@github-jira-sync-bot github-jira-sync-bot added Evaluated 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: ready for dev Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. labels Aug 4, 2023
@github-jira-sync-bot
Copy link
Author

The issue was exported from the internal Jira. The link to the original Jira issue: https://jira.corp.adobe.com/browse/ACP2E-2155

@m2-assistant
Copy link

m2-assistant bot commented Aug 4, 2023

Hi @github-jira-sync-bot. 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.

@m2-community-project m2-community-project bot added this to Ready for Development in High Priority Backlog Aug 4, 2023
@abukatar
Copy link
Contributor

@magento I am working on this

@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Done in High Priority Backlog Oct 18, 2023
@m2-community-project m2-community-project bot moved this from Done to Pull Request In Progress in High Priority Backlog Oct 18, 2023
@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Done in High Priority Backlog Oct 18, 2023
@m2-community-project m2-community-project bot moved this from Done to Pull Request In Progress in High Priority Backlog Oct 18, 2023
@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Done in High Priority Backlog Oct 18, 2023
@chittima
Copy link
Contributor

Here is the commit id: fc6075e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Evaluated 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: done Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
Development

No branches or pull requests

3 participants