Skip to content

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

Add channels - shipping zones relations in populatedb

IKarbowiak6734b74f2e85
diff --git a/saleor/core/utils/random_data.py b/saleor/core/utils/random_data.py
index 24941b9e5a..0be998bec2 100644
--- a/saleor/core/utils/random_data.py
+++ b/saleor/core/utils/random_data.py
@@ -869,7 +869,8 @@ def create_shipping_zone(shipping_methods_names, countries, shipping_zone_name):
for name in shipping_methods_names
]
)
- for channel in Channel.objects.all():
+ channels = Channel.objects.all()
+ for channel in channels:
ShippingMethodChannelListing.objects.bulk_create(
[
ShippingMethodChannelListing(
@@ -883,6 +884,7 @@ def create_shipping_zone(shipping_methods_names, countries, shipping_zone_name):
for shipping_method in shipping_methods
]
)
+ shipping_zone.channels.add(*channels)
return "Shipping Zone: %s" % shipping_zone