Is there a way to create a product with one or many variants and attach a variant image to the variants right away.
To my understanding:
I create a product with images and variants ---> Shopify will generate IDs for those images and variants
Than I'd retrieve those IDs and match them - VARIANT ID { image_id : IMAGE_ID} with the Variant API
Can I do this instead?
POST /admin/api/2019-10/products.json
{ "product": { "title": "Product 1", "variants" : [{"option1": "Default Title", IMAGE_SRC: "https//something"}]
} }
Thank you
Hey Giulio,
I don't believe you can do this via the REST API (see this thread from a year ago), however, it appears to be possible in the productCreate GraphQL API.
Hi,
Thanks for the link
I will stick to REST for now though,
I think that the shortest path to take using rest is to create in one go products and variants
and later POST the images to the product by the images endpoint with the list of variants id
One can also create the product with variants and images together, but then you have to retrieve the image id and pass them to the variants, which becomes a bowl of spaghetti
User | Count |
---|---|
13 | |
12 | |
7 | |
4 | |
4 |