Updates the pricing for a product variant. Set the pricing method, then the price, cost and weight. Method is 0 for master, 1 for specific or 2 for sum.
Before you begin#
- The API token needs
ProductVariantPricing_Update, 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 variant’sVariant_ID.
Example requests#
Update a variant’s pricing#
Sets the variant to the sum pricing method with a price, cost and weight.
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "ProductVariantPricing_Update",
"Product_ID": "{{Product_ID}}",
"Variant_ID": "{{Variant_ID}}",
"Method": 2,
"Price": 99.99,
"Cost": 99.99,
"Weight": 99.99
}
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 |
|
variant_id |
Number | Yes | The variant id of the product |
method |
Number/String | Yes | 0 = master 1 = specific 2 = sum |
price |
Number | The variant price | |
cost |
Number | The variant cost | |
weight |
Number | The weight of the variant |
Example response#
{
"success": 1
}
Response parameters#
| Parameter | Type | Description |
|---|---|---|
success |
Boolean | Boolean value indicating if the API request was successful |
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 > ProductVariantPricing_Update. See Set Up Postman.