Admin API: how to avoid create duplicate product

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.

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

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.

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”,

}

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