-
Notifications
You must be signed in to change notification settings - Fork 153
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@naydav Could you check my questions in the review, please? Thanks
@@ -15,6 +15,7 @@ type Mutation { | |||
setBillingAddressOnCart(input: SetBillingAddressOnCartInput): SetBillingAddressOnCartOutput | |||
setShippingMethodsOnCart(input: SetShippingMethodsOnCartInput): SetShippingMethodsOnCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SetShippingMethodsOnCart") | |||
addSimpleProductsToCart(input: AddSimpleProductsToCartInput): AddSimpleProductsToCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddSimpleProductsToCart") | |||
addVirtualProductsToCart(input: AddVirtualProductsToCartInput): AddVirtualProductsToCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddVirtualProductsToCart") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we reuse resolver from addSimpleProductsToCart
(rename in order to have a more universal name) here? Resolvers for simple and virtual products are identical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we need to reuse configurable for simple because the code is the same (and we will have copy paste detector fail)
*/ | ||
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) | ||
{ | ||
$cartHash = $this->arrayManager->get('input/cart_id', $args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are not going to use the resolver for virtual/simple products, should we add an additional check for the product type in a resolver?
Currently we can add simple product via virtual product mutation and vice versa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to have 2 different resolvers with checking of product type, but all general logic should be moved to Model in a separate class
Also, need to cover functionality with API-functional tests (including negative scenarios with a wrong product type)
Thanks
…l-cart # Conflicts: # app/code/Magento/QuoteGraphQl/Model/Cart/ExtractDataFromCart.php
Hi @rogyar, thank you for your contribution! |
Documented as part of magento/devdocs#4502 |
Description (*)
This PR adds a possibility to add virtual products to the shopping cart
Fixed Issues (if relevant)
Manual testing scenarios (*)
Use the following query with your own values to add a virtual product