GraphQL - Bulk import data with the GraphQL Admin API

GraphQL - Bulk import data with the GraphQL Admin API

eartisan
Shopify Partner
1 0 0

Hello,

Could someone kindly explain how to create products with variants and attach images to those variants at the same time we create those products, using the GraphQL Admin API? We have followed the guidelines given here and the other Shopify GraphQL API documentation. We have managed to get multiple products with various variants but despite all our efforts we can't figure out how to do the following.

1) Attach images to variants at the time of product and variant creation. We have managed to get media uploaded to main gallery but not to individual variants. We tried pretty much everything we came across with including the details given here with no luck. We would like to submit the URL of the image/media location of the variant so it gets added/downloaded and attached to variant when we create the parent product.

2) How to create products with the same title. If we try the same product title with totally different variations, it would only create the first product in single operation. It allows us to create them separately (separate queries), but not in the same query. Someone has raised the same question for the REST API a couple of years ago here with no answer. 

Any guidance is highly appreciated. Many thanks in advance.

Reply 1 (1)

Iliasshad
Shopify Partner
31 0 9

I had a similar issue about linking product variant images in product creation using Shopify bulk importation.  

Here's the solution for your first point: https://gist.github.com/IliasHad/98bae9da0be73bcc392f54f00b4bf718

 

For the second point, you can create a product with the same title but you should have a different handle set in products JSONL file you upload to Shopify