Add a Variant to a product - REST API

Highlighted
New Member
5 0 0

Hey guys !

 

I would like to add an option/variant to an existing product.

I've tried trough the variant endpoint : "products/xxxxxxxxxxx/variants.json"

With a JSON like this : 

{
"variant": {
"option1": "T2",
"price": "63.00"
}
}

 

And i keep getting a 422 error.

Thanks for the help.

0 Likes
Highlighted
Shopify Partner
353 24 75

Quick couple of questions:

  • You've verified that the product id is correct?
  • Are you explicitly setting Content-Type: application/json in the request header?
  • Is the body defined as raw: json in your request?
  • You've verified the request type is set as POST?

Usually if I run into issue with my code I just try using cURL or Postman to strip things down. Of course with Postman I always have to remember the option of disabling sending any client-side cookies. 

1 Like
Highlighted
New Member
5 0 0

Hi Greg,

 

Yep I already have verified all of these.

0 Likes