This repository has been archived by the owner on Dec 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 154
Adjust adding configurable products to the shopping cart #438
Labels
Checkout
Component: QuoteGraphQl
Contribution Day
Tickets is good for start on Contribution Day
good first issue
Good for newcomers
Milestone
Comments
@rogyar You vision is absolutely correct So, we need to have implement support of
|
naydav
added
Checkout
Contribution Day
Tickets is good for start on Contribution Day
good first issue
Good for newcomers
and removed
bug
Something isn't working
labels
May 2, 2019
pmclain
added a commit
to pmclain/graphql-ce
that referenced
this issue
May 11, 2019
Allows adding configurable products to cart in the same manner as the current Magento storefront. Fixes magento#438
4 tasks
pmclain
added a commit
to pmclain/graphql-ce
that referenced
this issue
May 17, 2019
Allows adding configurable products to cart in the same manner as the current Magento storefront. Fixes magento#438
m2-community-project
bot
added
Progress: PR created
and removed
Progress: PR created
labels
Jun 10, 2019
lenaorobei
added a commit
that referenced
this issue
Jul 31, 2019
4 tasks
lenaorobei
added a commit
that referenced
this issue
Aug 1, 2019
lenaorobei
added a commit
that referenced
this issue
Aug 1, 2019
lenaorobei
added a commit
that referenced
this issue
Aug 1, 2019
lenaorobei
added a commit
that referenced
this issue
Aug 1, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Checkout
Component: QuoteGraphQl
Contribution Day
Tickets is good for start on Contribution Day
good first issue
Good for newcomers
Desciption
Currently, we use the same approach for adding configurable products to the shopping cart as for the simple products. As result, we are able to add only simple products using
addConfigurableProductsToCart
mutation.Take a look at the following mutation:
configurable-product-option1
andconfigurable-product-option2
are SKUs of the simple products. There's no mention about a configurable product that we are going to add to the shopping cart.variant_sku
is not being processed in resolvers or somewhere else. So, yes, this field is useless.After using the mentioned query we will have two simple products in the shopping cart (
configurable-product-option1
,configurable-product-option2
) but zero configurable products.Ideally, the mutation should have the following look:
In this case, we would have two configurable parent products in the cart and two corresponding simple items. This scenario corresponds to the scenario we have currently in storefront->backend flow.
But, as it was mentioned, this query will not work since
variant_sku
is not processed.We could simply add
variant_sku
processing. But, unfortunately, things are not that easy.In order to create a correct buy request for a configurable product (https://github.com/magento/graphql-ce/blob/2.3-develop/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php#L79) we need to pass super attributes values of the configurable product to this request, but not SKU of a child product.
The storefront is designed in the following way:
From the PWA perspective, I believe we should use a similar approach. Instead of possibility to pass a child product's SKU we should use super attributes (unless child products are going to be shown instead of attributes on a configurable PDP)
So the schema will look something like:
Current GraphQl schema and resolvers don't respect this flow and we have no information about selected super attributes. So we cannot pass this information to the buy request. We have SKU of the child product but It's really hard to convert SKU -> supper attributes:values. The system designed to process it in reverse order: super attributes:values -> SKU.
The text was updated successfully, but these errors were encountered: