Deletes one or more variants from a product. Pass the product and the IDs of the variants to remove. The response says how many were deleted.
Before you begin#
- The API token needs
ProductVariantList_Delete, 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
Product_ID,Edit_Product,Product_CodeorProduct_SKU, and the IDs of the variants to delete.
Example requests#
Delete a variant#
Deletes variant 8 from the product.
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "ProductVariantList_Delete",
"Product_ID": "{{Product_ID}}",
"ProductVariant_IDs": 8
}
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 |
|
ProductVariant_ids |
Array | Yes | The id numbers of the product variants to be deleted |
Example response#
{
"success": 1,
"processed": 1
}
Response parameters#
| Parameter | Type | Description |
|---|---|---|
success |
Boolean | Boolean value indicating if the API request was successful |
processed |
Number | The number of product variants deleted |
Related functions#
| Function | Use it to |
|---|---|
ProductVariant_Insert |
Create a product variant |
ProductVariant_Update |
Change a product variant |
ProductVariantList_Load_Query |
Load a product’s variants |
ProductVariantList_Load_Product |
Load the variants of a product |
Try in Postman#
In the Miva: JSON API: Authenticated collection, open Products > ProductVariantList_Delete. See Set Up Postman.