Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Remove unwanted fields form order update cleaned input

fowczarek92ef0df0aea8
diff --git a/saleor/graphql/order/mutations/orders.py b/saleor/graphql/order/mutations/orders.py
index 2c7e0954ab..c4f0b1d878 100644
--- a/saleor/graphql/order/mutations/orders.py
+++ b/saleor/graphql/order/mutations/orders.py
@@ -154,6 +154,18 @@ class OrderUpdate(DraftOrderUpdate):
error_type_class = OrderError
error_type_field = "order_errors"
+ @classmethod
+ def clean_input(cls, info, instance, data):
+ draft_order_cleaned_input = super().clean_input(info, instance, data)
+
+ # We must to filter out field added by DraftOrderUpdate
+ editable_fields = ["billing_address", "shipping_address", "user_email"]
+ cleaned_input = {}
+ for key in draft_order_cleaned_input:
+ if key in editable_fields:
+ cleaned_input[key] = draft_order_cleaned_input[key]
+ return cleaned_input
+
@classmethod
def save(cls, info, instance, cleaned_input):
super().save(info, instance, cleaned_input)