Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add chennel data to order webhook (#7299)
Krzysztof Wolski25a1a1836298
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f58006b04b..90372cfba6 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -138,6 +138,7 @@ All notable, unreleased changes to this project will be documented in this file.- drop `created` argument from `draftOrders` query- drop `productType` from `ProductFilter`- deprecate mutations' `<name>Errors`, typed `errors` fields and remove deprecation+- Add channel data to Order webhook - #7299 by @krzysztofwolski### Otherdiff --git a/saleor/webhook/payloads.py b/saleor/webhook/payloads.pyindex a42073f916..a183787b33 100644--- a/saleor/webhook/payloads.py+++ b/saleor/webhook/payloads.py@@ -130,12 +130,16 @@ def generate_order_payload(order: "Order"):"translated_name","reason",)++ channel_fields = ("slug", "currency_code")shipping_method_fields = ("name", "type", "currency", "price_amount")+lines = order.lines.all()order_data = serializer.serialize([order],fields=ORDER_FIELDS,additional_fields={+ "channel": (lambda o: o.channel, channel_fields),"shipping_method": (lambda o: o.shipping_method, shipping_method_fields),"payments": (lambda o: o.payments.all(), payment_fields),"shipping_address": (lambda o: o.shipping_address, ADDRESS_FIELDS),