question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Product configurable options - can’t add the same SKU with different configurations to the cart

See original GitHub issue

Current 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

  1. Go to: https://demo.vuestorefront.io/gear/gear-3/sprite-yoga-companion-kit-45.html
  2. Add the product to cart with default options - price is $75.03.
  3. 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 Request 2. Feature / Improvement back to develop.
  • 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 Request 3. Stabilisation fix back to release.
  • 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 or master branch and create Pull Request 4. Hotfix back to hotfix.

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:closed
  • Created 4 years ago
  • Comments:10

github_iconTop GitHub Comments

2reactions
pkarwcommented, May 29, 2019

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)

0reactions
Djancypcommented, Nov 26, 2019

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)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found