Returns how many variants a product kit has. Identify the kit product by its ID, code or SKU.
Before you begin#
- The API token needs
ProductKit_Variant_Count, 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 kit product’s ID, code or SKU.
Example requests#
Count a kit’s variants#
Returns the number of variants for product 1.
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "ProductKit_Variant_Count",
"Product_ID": 1
}
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 |
Example response#
{
"success": 1,
"data": {
"variants": 1
}
}
Response parameters#
| Parameter | Type | Description |
|---|---|---|
success |
Boolean | Boolean value indicating if the api request was successful |
variants |
Number | The number of variants in the product kit |
Related functions#
| Function | Use it to |
|---|---|
ProductKit_Generate_Variants |
Generate the variants for a product kit |
ProductKit_Update_Parts |
Set the parts of a product kit |
ProductKitList_Load_Query |
List a kit’s attribute options and their parts |
ProductVariantList_Load_Product |
Load a product’s variants and their parts |
Try in Postman#
In the Miva: JSON API: Authenticated collection, open Products > ProductKit_Variant_Count. See Set Up Postman.