We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Re: Admin API: how to avoid create duplicate product

Admin API: how to avoid create duplicate product

cloudymum
Visitor
3 0 0

Could anyone answer me?

Is there any way to avoid create duplicate product?

E.g. custom_collection, if post with exsited "handle", it will return 422 error.

Replies 4 (4)

BundleSync
Shopify Partner
755 38 163

Hi

You may need to provide some more information. If you are getting the error than I'm assuming you are not able to create a duplicate product already. Or do you mean you want to see this error to avoid using same handle? The handle is always unique so cannot be duplicated across different products.

Regards

Tom

BundleSync - create native Shopify bundles in bulk quick and easy.
Bundleup - bundle your products and unbundle your bundle orders post purchase using our backend inventory management features.
MYOB Sync - connect your MYOB account to sync orders, customers, payments and inventory.
Get in touch with our team here.
cloudymum
Visitor
3 0 0

It will generate a new "handle" with suffix like '-1', '-2', ... when call product post with a exsited "handle".

I just want to know is there any field when i call product post with an exsited, then it would return error.

Ysi
Shopify Partner
1 0 0

I face same troubles, and I tried to set id when id of some handle exists like below, so as to update nothing. However, products are duplicated...

I would like for Shopify team to deal with  this problem.
===

"query": "mutation productCreate($input: ProductInput!,  $media: [CreateMediaInput!]) { productCreate(input: $input,  media: $media) { product { id } } }",
    "variables": {
        "input": {
            "id": "gid://shopify/Product/xxxx",
            ...
}
GrantDB
Shopify Partner
82 3 15

Don't suppose anyone found a solution to this did they?  When doing a create fail if the handle already exists.  Just some flag in the payload would be enough.

 

Thanks

Grant