Options is invalid - name of option is not unique

rodrigosqquid
Tourist
4 0 1

Hello everyone,

 

I'm trying to update a product and its variants using the rest api. I'm using the latest version of the API and my request is the following:

 

{ 
variants: [ { sku: '1323522109', inventory_management: 'shopify', option1: 'O/S', option2: 'DARKPLUM', id: 34081633960071 }, { sku: '1323522110', inventory_management: 'shopify', option1: 'O/S', option2: 'ORACRUSH', id: 34081633992839 } ], published: false, options: [ { name: 'Size' }, { name: 'Color' } ], id: '5007468494983' }

The API responds with a 422 status response containing the following message:

 

{"options":["is invalid"],"name":["of Option is not unique"]}

The message seems to point at the "options" attribute of the product. As additional info, the product and variants already exist in shopify, and the product's options array contains only Color. 

 

Any ideas? Your help is much appreciated.

0 Likes
_JB
Shopify Staff
Shopify Staff
750 87 165

Hey @rodrigosqquid,

 

You're seeing this error because you're providing the same option name in option1 for both variants. Since you're not sending a unique value for size, you can omit that and just send the color options. 

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes