To facilitate inventory tracking, Venddor IO allows products to be grouped into option combinations. Consider selling clothes in various colors and sizes. It becomes easier to track how many blue XL T-shirts or white M T-shirts you have in stock. These combinations even enable you to segregate by code and image.
For an option to be part of these combinations in Venddor IO, it must have the 'Inventory' checkbox activated, denoted by inventory=Y. This is primarily available for Checkbox, Select box, and Radiogroup types.
To fetch a list of option combinations for a product, initiate a GET request:
GET /api/combinations/?product_id=12
A successful request provides a list of all option combinations for that product.
For controlling the number of option combinations in the response, you can use parameters:
items_per_page: Dictates the number of option combinations per page.page: Used in conjunction with items_per_page, determines which page of results to fetch.For instance:
GET /api/combinations/?product_id=12&items_per_page=2&page=3
This request will yield 2 option combinations from the third page.
On sending a test request like:
GET /api/combinations/?product_id=12&items_per_page=2
A successful response, besides being HTTP/1.1 200 OK, contains pertinent data about the combination, including product id, combination hash, associated options, and image details.
To get in-depth details of a particular option combination, dispatch a GET request:
GET /api/combinations/822274303
This yields a detailed JSON response of that combination.
Various elements form an option combination. For instance, product_id denotes the associated product, combination_hash signifies the unique combination id, and combination represents the exact combination of options.
To form a new combination, a POST request to /api/combinations/ is necessary. The request body must include the product id and the specific combination of options:
{
"product_id": "4",
"combination": {
"24": "74",
"25": "80",
"26": "86"
},
"amount": "34",
"position": "10"
}
If executed correctly, you'll receive a combination hash as confirmation.
Existing combinations can be adjusted using a PUT request:
PUT /api/combinations/2822626827
This can alter elements like stock amount, product code, or its position on a list.
To remove a specific option combination, a DELETE request with the product ID (to verify permissions) is needed:
DELETE /api/combinations/2822626827?product_id=4