Option combinations allow you to track inventory for specific combinations of product options. This endpoint enables you to create new option combinations for your products.
Creates a new option combination for a specific product.
Pass the following parameters in the HTTP request body according to your specified Content-Type:
| Parameter | Type | Required | Description |
|---|---|---|---|
| product_id* | integer | Yes | The unique identifier of the product that the option combination is associated with. |
| amount | integer | No | How many items of this combination are in stock. Only appears in the Administration panel if the product is tracked with options. |
| position | integer | No | The lower this number, the higher the option combination appears on the list in the Administration panel. |
| combination | object | No | The options and variants that comprise the combination. The object keys are option IDs and values are variant IDs. |
inventory=Y.
image_pairs or product_code with the POST request. These can only be set with a subsequent PUT request.
{
"product_id": "4",
"combination": {
"24": "74",
"25": "80",
"26": "86"
},
"amount": "34",
"position": "10"
}
This request creates a new option combination for the product with product_id=4. This combination consists of:
There are 34 items of this particular combination in stock, and it will appear at position 10 in the admin interface list.
{
"combination_hash": "2822626827"
}
Returned when the option combination couldn't be created due to invalid parameters or other issues.
When creating option combinations, consider the following best practices:
inventory=Y in its settings.