Retrieves a product's variants and the parts that make up each one.
Retrieves the variants of a product, with the parts and attribute options that make up each one. Variants in Miva are the different attribute combinations, typically used to track inventory at the attribute level. Use Limits and Exclusions to narrow the list to variants with or without certain attributes and options.
Before you begin#
- The API token needs
ProductVariantList_Load_Product, either assigned directly under Functions or through a group. See Create an API token. - Requests must be signed if the token requires it. See Make a signed request with HMAC.
- You need the product’s ID, code or SKU.
Example requests#
Retrieve a product’s variants#
Returns every variant of the product with code tshirt.
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "ProductVariantList_Load_Product",
"Product_Code": "tshirt"
}
Request parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
product_idEdit_ProductProduct_CodeProduct_SKU |
Number String String String |
ID Number of product Product code string Product code string Product SKU string |
|
Include_Default_Variant |
Boolean | No | Boolean Value to include the default variant |
Limits |
Object | limits the results to variants that include attributes/options defined | |
Exclusions |
Object | limits the results to variants that do not include attributes/options defined |
Limits Object#
Limits the results to variants that include attributes/options defined.
| Parameter | Type | Description |
|---|---|---|
attr_id |
Number | Attribute ID |
attmpat_id |
Number | Attribute Template Id |
option_id |
Number | Option ID |
Exclusions Object#
Limits the results to variants that do not include attributes/options defined.
| Parameter | Type | Description |
|---|---|---|
attr_id |
Number | Attribute ID |
attmpat_id |
Number | Attribute Template Id |
option_id |
Number | Option ID |
Example response#
{
"success": 1,
"data": [
{
"product_id": 16,
"variant_id": 15,
"parts": [
{
"product_id": 20,
"product_code": "tshirt_medium_red",
"product_name": "T-Shirt size:medium color:red",
"quantity": 1
}
],
"dimensions": [
{
"attr_id": 3,
"attmpat_id": 0,
"option_id": 9,
"option_code": "medium"
},
{
"attr_id": 5,
"attmpat_id": 0,
"option_id": 12,
"option_code": "red"
}
]
},
...
]
}
Response parameters#
| Parameter | Type | Description |
|---|---|---|
product_id |
Number | Product ID |
variant_id |
Number | Variant ID |
parts |
Object | Parts which make up the variant. Unless the variant is a kit, each variant will have a single part. The part is the non-active product used to store pricing and inventory data. |
dimensions |
Object | Dimensions is an object containing the different combinations of attributes which make up this variant. |
parts Object#
Parts which make up the variant. Unless the variant is a kit, each variant will have a single part. The part is the non-active product used to store pricing and inventory data.
| Parameter | Type | Description |
|---|---|---|
product_id |
Number | Product ID |
product_code |
String | Part Product Code |
product_name |
String | Part Product Name |
quantity |
Number | Part Quantity |
dimensions Object#
Dimensions is an object containing the different combinations of attributes which make up this variant.
| Parameter | Type | Description |
|---|---|---|
attr_id |
Number | Attribute ID |
attmpat_id |
Number | Attribute Template Id |
option_id |
Number | Option ID |
option_code |
String | Option Code |
Related functions#
| Function | Use it to |
|---|---|
ProductVariantList_Load_Query |
Load a product’s variants with a list query |
ProductVariant_Insert |
Create a variant |
ProductVariant_Update |
Change a variant |
ProductVariantList_Delete |
Delete variants |
AttributeAndOptionList_Load_Product |
Load the attributes and options a variant is built from |
ProductList_Adjust_Inventory |
Adjust product inventory counts |
Try in Postman#
In the Miva: JSON API: Authenticated collection, open Products > ProductVariantList_Load_Product. See Set Up Postman.