Shopify REST API 422 post "The variant 'Default Title' already exists."

Shopify REST API 422 post "The variant 'Default Title' already exists."

CarlosWarrior
Shopify Partner
1 0 0

Hi! I am trying to create a product with multiple variants on the go at the post endpoint {key}:{pass}@{store}@psf-ocotlan-dev.myshopify.com/admin/api/2022-07/products.json

 

 

The body of my request is the following:

 

 

 

{
	"title": "RESALTADOR DE TEXTO SHARPIE - 1 PZA",
	"handle": "RESALTADOR DE TEXTO SHARPIE, PUNTA 6 mm - 1 PZA - ROSA",
	"body_html": "RESALTADOR DE TEXTO SHARPIE, PUNTA 6 mm - 1 PZA - ROSA",
	"vendor": "VAZQUEZ HERMANOS Y COMPAÑÍA SA DE CV",
	"product_type": "MARCATEXTO",
	"variants": [
		{
			"sku": "SHARPIE-MARCATEXTO-ROSA-RESA-0000010",
			"inventory_management": "shopify",
			"fulfillment_service": "manual",
			"inventory_policy": "continue",
			"inventory_quantity": 0,
			"color": "ROSA"
		},
		{
			"sku": "SHARPIE-MARCATEXTO-AZUL-RESA-0000011",
			"inventory_management": "shopify",
			"fulfillment_service": "manual",
			"inventory_policy": "continue",
			"inventory_quantity": 0,
			"color": "AZUL"
		},
		{
			"sku": "SHARPIE-MARCATEXTO-AMARILLO-RESA-0000012",
			"inventory_management": "shopify",
			"fulfillment_service": "manual",
			"inventory_policy": "continue",
			"inventory_quantity": 0,
			"color": "AMARILLO"
		}
	],
	"options": [
		{
			"name": "color",
			"position": 1,
			"values": [
				"ROSA",
				"AZUL",
				"AMARILLO"
			]
		}
	],
	"images": [],
	"create_at": "2022-09-04T20:45:28.975Z",
	"updated_at": "2022-09-04T20:45:28.975Z"
}

 

 

 

 

As you can see, I have set an options property on the Product object composed as {name, position and values}.

I have also set a color property on each variant. You see all occurrances of the color property  on each variant is present in the values array of the singe option.

 

When I post the body, I get a 422 error with the following object on the response:

 

 

 

error: {data: { base: [ "The variant 'Default Title' already exists." ] }

 

 

 

 

 

Pleas tell me about and help me with this "The variant 'Default Title' already exists." error.

 

The ID of my request is:

 

 

'x-request-id': 'de17653d-4b7f-44f9-9147-2cc5df6d7d55',

 

 

 

 

Replies 0 (0)