Hi everyone, I'll get straight to the point.
I'm trying to import a product from my Yii2 site to my Shopify store.
This is my idea:
I create the product with the productCreate mutation.
I create the variants with productVariantsBulkCreate.
But it gives me an error saying that a variant already exists and is created by default. How can I bypass this? Since they're dynamic, I have no way of knowing which variant has already been created.
Hey all - just +1ing @JordanFinners here and adding a bit of context. It is expected behaviour that when a product is created, a “default variant” is always created alongside it. This happens since the fulfillment/inventory management features on Shopify depend on product variants/merchandise to exist in order to process things correctly.
The productSet mutation Jordan shared above is the best method to set up products and upon product creation you should be able to include the child variant as a field you want surfaced in the API response. Hope this helps as always!