According to the Shopify documentation you can post a product variant like so:
"variant" => [
"title" => "Guzman",
"price" => "44.90",
"sku" => "160011",
"position" => 1,
"inventory_policy" => "continue",
"compare_at_price" => null,
"fulfillment_service" => "manual",
"inventory_management" => "shopify",
"option1" => "Option1",
]
The above example is using Guzzle. The above code posts to the product I’m referencing. The problem is I can’t find how to change or set the option title. In example the default one is title:
On the shopify admin this would be set by “Edit Options” but I don’t find anywhere in the API documentation on how this could be set.
2
Answers
The solution for this was that the variant title is not actually in variant. It is in product api.
The correct way to modify the title would be like this:
Further documentation here: https://help.shopify.com/en/api/reference/products/product
What threw me off was that I was in the variant api assuming variant would be where the title was.
As far as I know, title is based on your option.
if option1 is red and option2 is large, title would be
red / large
.If you want to change Default Title, pass option value in title field as follow in variants array.
You can try it in postman and let me know if this worked for you.