Skip to content

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

Save shipping method name to order

Anna Siwik907e1a9441d0
diff --git a/saleor/checkout/core.py b/saleor/checkout/core.py
index 4aee07cf60..ef75e38440 100644
--- a/saleor/checkout/core.py
+++ b/saleor/checkout/core.py
@@ -323,12 +323,16 @@ class Checkout:
net=Money(0, settings.DEFAULT_CURRENCY),
gross=Money(0, settings.DEFAULT_CURRENCY))
+ shipping_method_name = (
+ smart_text(self.shipping_method) if self.is_shipping_required
+ else None)
order_data = {
'language_code': get_language(),
'billing_address': billing_address,
'shipping_address': shipping_address,
'tracking_client_id': self.tracking_code,
'shipping_price': shipping_price,
+ 'shipping_method_name': shipping_method_name,
'total': self.get_total()}
if self.user.is_authenticated:
diff --git a/templates/order/_ordered_items_table.html b/templates/order/_ordered_items_table.html
index 998e9499c4..08f70c0399 100644
--- a/templates/order/_ordered_items_table.html
+++ b/templates/order/_ordered_items_table.html
@@ -77,7 +77,7 @@
<div class="row">
<div class="col-8 order-details__table-footer">
<p>
- {% trans "Shipping total" context "Order details shipment row text" %} ({{ order.shipping_method_name }})
+ {% trans "Shipping total" context "Order details shipment row text" %} ({{ order.shipping_method_name|default:"-" }})
</p>
</div>
<div class="col-4">