Skip to content

Attribute_Insert#


Description#

This function inserts an attribute directly into a product.

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
code String Attribute code
prompt String Name of the attribute prompt
image String Filepath for the attribute image
type String Type of selector used for the attribute
price Number The price of the attribute
cost Number The cost of the attribute
weight Number The weight of the attribute
default Boolean Boolean value indicating if the attribute is the default selection for the product
required Boolean Boolean value indicating if selecting the attribute is required for purchase
inventory Boolean Boolean value indicating if the attribute is recorded in inventory

Response Parameters#

Parameter
Type Description
success Number 1 indicating a successful request.
0 indicating an unsuccessful request.
data Object Object containing function attributes and option list of product
id Number ID Number of attribute
product_id Number ID Number of product
default_id Number ID default option if available (default is 0)
disp_order Number Display order number
code String Attribute code
type String Attribute type (radio,select,checkbox,text,memo,template,swatch-select)
attemp_id Number ID Number of attribute template (default is 0)
prompt String Prompt for attribute
price Number Price of attribute
formatted_price String Formatted price of attribute
cost Number Cost of attribute
formatted_cost String Formatted cost of attribute
weight Number Weight of attribute
required Boolean True or False value for required
inventory Boolean True or False value for inventory active
image String Filepath for the attribute image

Example Request#

{
    "Store_code": "beta",
    "Function": "Attribute_Insert",
    "Product_ID": 1,
    "Code": "size",
    "Prompt": "Size",
    "Image": "",
    "Type": "radio",
    "Price": "0.00",
    "Cost": "0.00",
    "Weight": "0.00",
    "Default": false,
    "Required": false,
    "Inventory": false
}

Example Response#

{
    "success": 1,
    "data": {
        "id": 554,
        "product_id": 2959,
        "default_id": 0,
        "disp_order": 556,
        "attemp_id": 0,
        "code": "size",
        "type": "radio",
        "prompt": "Size",
        "price": 0.00,
        "cost": 0.00,
        "weight": 0.00,
        "required": false,
        "inventory": false,
        "image": ""
    }
}

Error Responses#

Error Code Error Message Error Description
MER-JSN-00023 One or more parameters are invalid Attribute code already exists