Skip to content

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

Use model create insted of model save

fowczarek552dbbf70b42
diff --git a/saleor/graphql/product/mutations/products.py b/saleor/graphql/product/mutations/products.py
index a6b3f66126..400a4e2248 100644
--- a/saleor/graphql/product/mutations/products.py
+++ b/saleor/graphql/product/mutations/products.py
@@ -347,10 +347,9 @@ class ProductCreate(ModelMutation):
'track_inventory', site_settings.track_inventory_by_default)
quantity = cleaned_input.get('quantity', 0)
sku = cleaned_input.get('sku')
- variant = models.ProductVariant(
+ models.ProductVariant.objects.create(
product=instance, track_inventory=track_inventory,
sku=sku, quantity=quantity)
- variant.save()
@classmethod
def _save_m2m(cls, info, instance, cleaned_data):