Skip to content

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

Fix product created event on bulk product create main (#12605)

SzymJ83f7e8363001
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6b2f7b80f0..825f395cfe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,6 +26,8 @@ All notable, unreleased changes to this project will be documented in this file.
- Fix saving `description_plaintext` for product - #12586 by @SzymJ
- Remove default `EMAIL_URL` value pointing to console output; from now on EMAIL_URL has to be set explicitly - #12580 by @maarcingebala
+- Fix sending `product_created` event in `ProductBulkCreate` mutation - #12605 by @SzymJ
+
# 3.13.0
diff --git a/saleor/graphql/product/bulk_mutations/product_bulk_create.py b/saleor/graphql/product/bulk_mutations/product_bulk_create.py
index aef539fcc4..73ec0f1495 100644
--- a/saleor/graphql/product/bulk_mutations/product_bulk_create.py
+++ b/saleor/graphql/product/bulk_mutations/product_bulk_create.py
@@ -822,7 +822,7 @@ class ProductBulkCreate(BaseMutation):
def post_save_actions(cls, info, products, variants, channels):
manager = get_plugin_manager_promise(info.context).get()
for product in products:
- cls.call_event(manager.product_created, product)
+ cls.call_event(manager.product_created, product.node)
for variant in variants:
cls.call_event(manager.product_variant_created, variant)
diff --git a/saleor/graphql/product/tests/mutations/test_product_bulk_create.py b/saleor/graphql/product/tests/mutations/test_product_bulk_create.py
index d02b2ea3eb..9a32eef5b3 100644
--- a/saleor/graphql/product/tests/mutations/test_product_bulk_create.py
+++ b/saleor/graphql/product/tests/mutations/test_product_bulk_create.py
@@ -198,6 +198,8 @@ def test_product_bulk_create_send_product_created_webhook(
assert not data["results"][1]["errors"]
assert data["count"] == 2
assert created_webhook_mock.call_count == 2
+ for call in created_webhook_mock.call_args_list:
+ assert isinstance(call.args[0], Product)
def test_product_bulk_create_with_same_name_and_no_slug(