Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Expose CheckoutShippingMethodUpdate mutation
Pacu2c171c300bcaa
diff --git a/saleor/graphql/api.py b/saleor/graphql/api.pyindex 23d93c7813..d77c39dcdb 100644--- a/saleor/graphql/api.py+++ b/saleor/graphql/api.py@@ -57,7 +57,8 @@ from .checkout.types import CheckoutLine, Checkoutfrom .checkout.mutations import (CheckoutCreate, CheckoutLinesAdd, CheckoutLinesUpdate, CheckoutLineDelete,CheckoutCustomerAttach, CheckoutCustomerDetach,- CheckoutShippingAddressUpdate, CheckoutEmailUpdate, CheckoutComplete)+ CheckoutShippingAddressUpdate, CheckoutEmailUpdate, CheckoutComplete,+ CheckoutShippingMethodUpdate)from .checkout.resolvers import (resolve_checkouts, resolve_checkout_lines, resolve_checkout)@@ -295,6 +296,7 @@ class Mutations(ProductMutations):checkout_customer_attach = CheckoutCustomerAttach.Field()checkout_customer_detach = CheckoutCustomerDetach.Field()checkout_shipping_address_update = CheckoutShippingAddressUpdate.Field()+ checkout_shipping_method_update = CheckoutShippingMethodUpdate.Field()checkout_email_update = CheckoutEmailUpdate.Field()checkout_payment_method_create = CheckoutPaymentMethodCreate.Field()checkout_complete = CheckoutComplete.Field()diff --git a/saleor/graphql/checkout/mutations.py b/saleor/graphql/checkout/mutations.pyindex 6345fee60d..74c86be7db 100644--- a/saleor/graphql/checkout/mutations.py+++ b/saleor/graphql/checkout/mutations.py@@ -23,6 +23,11 @@ def clean_shipping_method(checkout, method, errors, discounts, taxes, country_code=None):if not method:return errors+ if not checkout.is_shipping_required():+ errors.append(+ Error(+ field='checkout',+ message='This checkout does not requires shipping.'))if not checkout.shipping_address:errors.append(Error(@@ -31,11 +36,6 @@ def clean_shipping_method('Cannot choose a shipping method for a ''checkout without the shipping address.')))return errors- if not checkout.is_shipping_required():- errors.append(- Error(- field='checkout',- message='This checkout does not requires shipping.'))valid_methods = (ShippingMethodModel.objects.applicable_shipping_methods(price=checkout.get_subtotal(discounts, taxes).gross.amount,