Skip to content

ProductVariant_Insert#


Description#

This function inserts a new product variant.

Request Parameters#

Parameter
Type 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
attribute_ids Number The attribute id of the product
AttributeTemplateattribute_ids Number The attribute template ids of the product attribute
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 Object containing the attribute codes and options
attr_code String String of attribute code assigned to variant
option_code String String of option code assigned to variant
parts Object Object containing the part codes and quantities
part_code String String of part product code assigned to variant
quantity Number Number of parts assigned to variant

Response Parameters#

Parameter
Type Description
success Boolean Boolean value indicating if the API request was successful
product_id Number The product id for the variant
variant_id Number The new variant id

Example Request#

{
    "Store_code": "beta",
    "Function": "ProductVariant_Insert",
    "Product_ID": 1,
    "Attribute_IDs": 9,
    "AttributeTemplateAttribute_IDs": 1,
    "Option_IDs": 1,
    "Part_IDs": 206,
    "Quantities": 1,
    "Function": "ProductVariant_Insert",
    "Attributes": [
        {
            "attr_code": "ATRIBUTE_CODE",
            "option_code": "OPTION_CODE"
        },
        {
            "attr_code": "ATRIBUTE_CODE",
            "option_code": "OPTION_CODE"
        }
    ],
    "Parts": [
        {
            "part_code": "PART_PRODCUCT_CODE",
            "quantity": 1
        },
        {
            "part_code": "PART_PRODCUCT_CODE",
            "quantity": 1
        }
    ]
}

Example Response#

{
    "success": 1,
    "data": {
        "product_id": 1,
        "variant_id": 9
    }
}