Created by potrace 1.16, written by Peter Selinger 2001-2019

Miva Developer Docs

Updates an existing product variant.


Updates an existing product variant. Identify the product and the variant, then pass the attributes, options and parts the variant should have.

Before you begin#

  • The API token needs ProductVariant_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_Code or Product_SKU, and the variant’s Variant_ID.

Example requests#

Update a variant#

Sets the variant’s attribute/option pairs and parts.

{
    "Store_Code": "{{Store_Code}}",
    "Miva_Request_Timestamp": "{{$timestamp}}",
    "Function": "ProductVariant_Update",
    "Product_ID": "{{Product_ID}}",
    "Variant_ID": "{{Variant_ID}}",
    "Attributes": [
        {
            "attr_code": "ATTRIBUTE_CODE",
            "option_code": "OPTION_CODE"
        },
        {
            "attr_code": "ATTRIBUTE_CODE",
            "option_code": "OPTION_CODE"
        }
    ],
    "Parts": [
        {
            "part_code": "PART_PRODUCT_CODE",
            "quantity": 1
        },
        {
            "part_code": "PART_PRODUCT_CODE",
            "quantity": 1
        }
    ]
}

Request parameters#

Parameter Type Required Description
product_id
Edit_Product
Product_Code
Product_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
attribute_ids Number The attribute ids of the product
AttributeTemplateAttribute_IDs Number The attribute template attribute ids of the product attributes
option_ids Number The option id numbers of the product
part_ids Number The id numbers of the product parts
quantities Number The part quantities for the product variant
attributes Object Array of the variant’s attributes and options
parts Object Array of the variant’s parts and quantities

attributes Object#

Parameter Type Description
attr_id Number Attribute ID. Use attr_id or attr_code, not both.
attr_code String Attribute code
attmpat_id Number Attribute template attribute ID. Use attmpat_id or attmpat_code, not both.
attmpat_code String Attribute template attribute code
option_id Number Option ID. Use option_id or option_code, not both.
option_code String Option code

When Attributes is present, Attribute_IDs, AttributeTemplateAttribute_IDs and Option_IDs are ignored.

parts Object#

Parameter Type Description
part_id Number Part ID. Use part_id or part_code, not both.
part_code String Product code of the part
quantity Number Quantity of Part. Required.

When Parts is present, Part_IDs and Quantities are ignored.

Example response#

{
    "success": 1
}

Response parameters#

Parameter Type Description
success Boolean Boolean value indicating if the API request was successful
Function Use it to
ProductVariant_Insert Create a product variant
ProductVariantPricing_Update Change a variant’s pricing
ProductVariantList_Delete Delete product variants
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 > ProductVariant_Update. See Set Up Postman.