We are having an error for multiple items when creating a new variant. For example, we are going to create this item with this JSON request.
JSON Body:
{“variant”:{“sku”:“27494-LIM-JNR”,“barcode”:“9312555369206”,“option1”:“Lime”,“option2”:“Junior”}}
And we are using this endpoint and method
Endpoint: https://steeden-rugby.myshopify.com/admin/api/2021-10/products/***********/variants.json
HTTP Method: POST
Upon sending this requesting, this is the error response that we get
JSON Response:
{
“errors”: {
“base”: [
“Option values provided for 1 unknown option(s)”
]
}
}
Take note that the options are already registered in the Shopify Admin page like the request we are trying to send. So we are confuse why we are receiving this error. Please see below when searching for those options in Shopify.
May we ask what are we missing
Hi @sherwinronx ,
just reading in https://shopify.dev/api/admin-rest/2022-04/resources/product-variant
that
The Product resource will have a variant for every possible combination of its options
Are you passing an array of options into the parent product creation call before creating the variant?
'Cause when you append variant to a product, it’s options should match at least one of the available options into the parent product
Yes those options are available to the parent product this is the array that I am sending
{“variant”:{“sku”:“27494-LIM-JNR”,“barcode”:“9312555369206”,“option1”:“Lime”,“option2”:“Junior”}}
Hi @sherwinronx
can’t help but notice that you are talking about options, but in your first post you attached a screenshot of TAGS …
Tags are not Options.
Please see attachment: in the product entity, in the options section (point 1) you have to declare an option(s) name(s) (point 2) and then you will be able to add option values for each option (point 3)
This from admin backend.
Using REST you have to create the product listing option names and values into the array so
{“product”: {“title”: “cool product”, “options”:[{“name”: “Size”, “values”: [“Junior”, “Medium”, “Large”]},{“name”: “Color”, “values”: [“Lime”, “Orange”]}]}}
then you can create a variant into this product (you could also use the same call)
{“variant”: {“option1”:“Junior”, “option2”: “Lime”}}