Can anyone help me to understand the relationships between Products, Options and Variations?
I would like to insert a “top level” product (e.g. Jeans) which will be available in three sizes (e.g. Small, Medium, Large)
and three colours (e.g. Black, Blue, Green). At this point no stock has been ordered so I want to leave it at that, i.e. no actual sellable variations yet.
I thus thought to insert the “top level” product with a POST to https://{my_shop}.myshopify.com/admin/api/2021-01/products.json as:-
{
"product": {
"title": "Jeans",
"options": [
{
"name": "Size",
"values": [
"Small",
"Medium",
"Large"
]
},
{
"name": "Colour",
"values": [
"Black",
"Blue",
"Green"
]
}
]
}
}
which results in the response:-
{
"errors": {
"base": [
"You need to add option values for Colour"
]
}
}
My intention was to use this “top level” product and “attach” variants when the merchant obtains stock ( which may well not be all combinations of the above options - Green may only be available in Medium).
I tried swapping the order of the options but that simply changed the error to “You need to add option values for Size”. I then tried removing the “Colour” option with:-
{
"product": {
"title": "Jeans",
"options": [
{
"name": "Size",
"values": [
"Small",
"Medium",
"Large"
]
}
]
}
}
the Response was:-
{
"product": {
"id": 6211926163652,
"title": "Jeans",
"body_html": null,
"vendor": "witchbag",
"product_type": "",
"created_at": "2021-02-22T13:29:58+00:00",
"handle": "jeans",
"updated_at": "2021-02-22T13:29:58+00:00",
"published_at": "2021-02-22T13:29:58+00:00",
"template_suffix": null,
"status": "active",
"published_scope": "web",
"tags": "",
"admin_graphql_api_id": "gid://shopify/Product/6211926163652",
"variants": [
{
"id": 38129887576260,
"product_id": 6211926163652,
"title": "Default Title",
"price": "0.00",
"sku": "",
"position": 1,
"inventory_policy": "deny",
"compare_at_price": null,
"fulfillment_service": "manual",
"inventory_management": null,
"option1": "Default Title",
"option2": null,
"option3": null,
"created_at": "2021-02-22T13:29:58+00:00",
"updated_at": "2021-02-22T13:29:58+00:00",
"taxable": true,
"barcode": null,
"grams": 0,
"image_id": null,
"weight": 0.0,
"weight_unit": "kg",
"inventory_item_id": 40223382241476,
"inventory_quantity": 0,
"old_inventory_quantity": 0,
"requires_shipping": true,
"admin_graphql_api_id": "gid://shopify/ProductVariant/38129887576260"
}
],
"options": [
{
"id": 7912966488260,
"product_id": 6211926163652,
"name": "Size",
"position": 1,
"values": [
"Default Title"
]
}
],
"images": [],
"image": null
}
}
This created a product with a single Variation (according to the Response) and on my Catalog I have a Product called “Jeans” with a single drop down list labelled “Size” containing a single item “Default Title”.
You may wonder why I don’t just wait until there are existing Variations of actual product; well this is the way the Fashion industry often works, sometimes with pre-ordered “drop offs”. They may also want to create a page with a “coming soon” type of theme.
Any help or explanation(s) or clarification(s) would be much appreciated.