Product configurable options - can’t add the same SKU with different configurations to the cart
See original GitHub issueCurrent behavior
When adding a product to cart 2 or more times, each time with different custom options which normally have different prices, the calculated total price is wrong.
Expected behavior
Тhe total price should be the sum of the prices for each product/options pair added to cart. Instead the price ends up being the quantity multiplied by the price of the last added to cart product (with its options), dismissing the prices of previously added products/options.
Steps to reproduce the issue
- Go to: https://demo.vuestorefront.io/gear/gear-3/sprite-yoga-companion-kit-45.html
- Add the product to cart with default options - price is $75.03.
- Add the product to cart again but choose “Sprite Stasis Ball 65 cm” option - with the custom option price becomes $79.95. Check microcart - it shows 2 pieces of the same product with total price $159.90, while expected price is $75.03 + $79.95 = $154.98.
Repository
Can you handle fixing this bug by yourself?
- YES
- NO
Which Release Cycle state this refers to? Info for developer.
Pick one option.
- This is a bug report for test version on https://test.storefrontcloud.io - In this case Developer should create branch from
develop
branch and create Pull Request2. Feature / Improvement
back todevelop
. - This is a bug report for current Release Candidate version on https://next.storefrontcloud.io - In this case Developer should create branch from
release
branch and create Pull Request3. Stabilisation fix
back torelease
. - This is a bug report for current Stable version on https://demo.storefrontcloud.io and should be placed in next stable version hotfix - In this case Developer should create branch from
hotfix
ormaster
branch and create Pull Request4. Hotfix
back tohotfix
.
Environment details
- Browser: Chrome Version 74.0.3729.169 (Official Build) (64-bit)
- OS: macOS Mojave 10.14.5
- Node:
- Code Version:
Additional information
Issue Analytics
- State:
- Created 4 years ago
- Comments:10
Top Results From Across the Web
Configurable Product created with existing SKUs won't let ...
To remedy, I went to Products> Catalog> Add Configurable Product and created a new product with same naming convention as the 16 existing...
Read more >cannot add configurable product to cart in magento
Your $product array is missing the options key values. You need to add options which should be An array in the form of...
Read more >Error of configurable products. - Magento Forums
We are trying to add grouped products into configurable products. We start off by creating grouped multiple grouped products, containing 2 SKU's ......
Read more >Updating options of configurable product that is already in ...
Let's say we have configurable Magento product in shopping cart and we want to update its options without deleting product from cart and ......
Read more >Configurable product | Adobe Commerce - Experience League
Step 3: Complete the required settings. Enter the product Product Name. Accept the default SKU that is based on the product name or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is related to #1620 and the way we’re identifying clients side configurable/bundle products with data we get from the server during the server sync (cart/serverAfterPuled action)
I have a solution for personalized products. Overite the core module productsEquals.ts. After this you will be able to add same SKU multiple time to basket and sync with m2. if(String(product1.sku ) === String(product2.sku)){ if(product1.product_option.extension_attributes.custom_options && product2.product_option){ let p1 = product1.product_option.extension_attributes.custom_options let p2 = product2.product_option.extension_attributes.custom_options let p1Array = [] let p2Array = [] for( let key in p1){ typeof p1[key].option_value === “undefined”? p1[key].option_value = null :p1[key].option_value=p1[key].option_value p1Array.push({ “option_id”: p1[key].option_id, “option_label”: p1[key].option_value }) } for( let key in p2){ p2Array.push({ “option_id”: p2[key].option_id, “option_label”: p2[key].option_value }) } let values = (o) => Object.keys(o).sort().map(k => o[k]).join(‘|’) let mapped1 = p1Array.map(o => values(o)) let mapped2 = p2Array.map(o => values(o)) var res = mapped1.every(v => mapped2.includes(v)) return res } } return String(product1.sku ) === String(product2.sku)