Skip to content
This repository was archived by the owner on Nov 14, 2023. It is now read-only.

Configurable Products with Simple Products as configurations can't be added to cart #4

Open
mohan-nishit opened this issue Feb 15, 2021 · 1 comment

Comments

@mohan-nishit
Copy link

Hi Michiel,

Running this on a M2.4.0 website, I was able to complete the entire order flow using only simple products. If I go to any Configurable product with the configuration as shown in the screengrab below, I get an error on adding the product to the cart.
image

Here is the product Detail Page. I'm able to see the configurations in the dropdown:
image

And here is the error I get on adding to cart:
image

FWIW, the SKU in the GraphQL request to add the product seems to be wrong. It seems the label is sent instead of the SKU.

The Magento 2.4 GraphQL docs have an example where the data for "Variants" can be fetched: https://devdocs.magento.com/guides/v2.4/graphql/interfaces/configurable-product.html#extended-example

I added the variants data to the App\GraphQL class, under PRODUCT_CONTENTS, and sure enough it returned the variant data as per my expectations:
image
Question is, how to go about modifying the checkout flow to accommodate for the variants?

@michielgerritsen
Copy link
Owner

Hi @mohan-nishit,

Thanks for opening this issue. When developing the configurable functionality I couldn't find the logic on how to find the correct SKU for the selected combination. So at this moment, the generated SKU is based on the parent SKU + the selected options. This works on the Magento Sample Data. You can find the code where this is done here:
https://github.com/michielgerritsen/TALL-Magento/blob/master/resources/views/product-options/configurable.blade.php#L47-L54

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants