How to restrict shopify API to create product from same sku

Solved
New Member
5 0 0

Hi All,

 

I am using shopify product APIs to create product for my store. Currently it creates a different product for all the requests. I want to restrict APIs to create product which has sku which is already present.

 

Is there any way to do it?

 

Thanks

-Prateek

0 Likes
Highlighted
Shopify Staff
Shopify Staff
607 82 89

Hey @Wrooker_com,

 

Are you looking to create multiple variants under the same product? Try ProductVariant.

Or are you looking to avoid duplicate products? I.e. if SKU already exists, don't create?

0 Likes
Highlighted
New Member
5 0 0

Thanks for Scotty,

 

Yes, second one is the option I want, i.e. "Or are you looking to avoid duplicate products? I.e. if SKU already exists, don't create?"

0 Likes
Highlighted

Success.

Shopify Staff
Shopify Staff
607 82 89

Thanks for clarifying. Shopify doesn't enforce unique SKUs so you will need to handle the validation on your end. Either keep a local copy of existing SKUs or send a query first to see if an SKU has been taken.

0 Likes
Highlighted
New Member
5 0 0

Thanks, that is what I thought of.

0 Likes