Create product variants using api. after the 50th variant, the number of quantity is 0.

iPutin
Tourist
8 1 0

I am creating product variants via api using shopify-api-node. I need to create 90 variants (no more than 100), the quantity of each variant must be 200. The script is running and product variants with quantity is creating.  But problems arise precisely after the 50th variant, after the 50th variant the variants are created with 0 quantity.  Do you have any ideas or guesses as to why this might be?

iPutin_0-1628170864904.png

 

Replies 2 (2)
iPutin
Tourist
8 1 0

my script creates 90 variants, then deletes the most recent one and adds a new variant, when a new variant is added, it was necessary to insert the quantity for a new variant. I needed to get all list of variants.

It turned out that when you retrieves a list of product variants, it returns only 50 variants by default, accordingly, I could not add quantity for the rest variants that went beyond 50.
I set the limit for the number of variants I needed, after which it worked

sillycube
Shopify Partner
693 16 100

You can change the limit parameter to more than 50 according to the product variant REST API.

BYOB - Build Your Own Bundles, SPO - SEO App to research keywords & edit social link preview