Create Product Option
POST
/products/{product}/optionsThis endpoint allows you to create a new option for a specific product by passing the product
as a path parameter.
:::tip[Note]
For the product.type
variable set to product
, creating a new product option will generate a new variant for this option.
:::
Request
The Product ID. List of Product ID can be found here.
A distinctive label or title assigned to a specific item or commodity, serving as an identifier and often conveying essential information about the product.
Product option field type
The various choices or variations of a product are visually presented to customers, typically categorized as text, image, or color representations.
Product option field visibilty
Visibility condition type. Required if the visibility
variable is set to on_condition
The product option's ID for the condition . Required if the variable visibility
is set to on_condition
The product option value's ID for the condition. Required if the variable visibility
is set to on_condition
The sort order of the product option
Whether or not the product has variants. If the product is of type product
, then adding an option to the product will set it to advance
. Default value is true
when the product type is set to product
Only works when the variable type
is set to date
Only works when the variable type
is set to date
Product Option values. Required if the variable type
is set to either radio
, file
, or checkbox
A descriptive label or title given to a specific attribute, feature, or characteristic associated with a product, helping to define and differentiate its various qualities or options.
The additional price which will be added to the product price when the customer adds/selects this value. Alternatively the value is set 0 if there is no additional price.
The display value in UI based on display type of option, by default will use the name of value as display value when the 'display_value=text', but in case you used 'image' then you need to set the image id as value You can upload a new image to product using attach image endpoint then use 'image' id from response, otherwise when use 'color' as display type you need to pass the color for example '#000' for black color. More about attaching an image from here
{
"name": "option name",
"required": true,
"visibility": "on_condition",
"visibility_condition_type": "=",
"visibility_condition_option": 2134428744,
"visibility_condition_value": 306646512,
"display_type": "image",
"values": [
{
"name": "value 3",
"price": "10",
"is_default": false
}
]
}
Request samples
[api.label.responses]
Response status code, a numeric or alphanumeric identifier used to convey the outcome or status of a request, operation, or transaction in various systems and applications, typically indicating whether the action was successful, encountered an error, or resulted in a specific condition.
Response flag, boolean indicator used to signal a particular condition or state in the response of a system or application, often representing the presence or absence of certain conditions or outcomes.
Detailed structure of the product option model object showing its fields and data types.
A unique identifier assigned to a specific product configuration or variant.
The label or title used to describe a specific choice or attribute associated with a product.
A text or content that provides detailed information about a product.
Type of the product option, it can be a radio
button or checkbox
Whether or not the product option is obligatory.
The product option is only relevant to order receiving time when it pertains to date-time selections. ONLY for date time options.
Product option sort refers to the method or criteria used to arrange or order product options.
The manner in which product choices or attributes are presented.
Product option visibility based on condition is applied exclusively to products categorized as 'food' or 'service', allowing certain choices or attributes to be shown or hidden based on specific criteria.
Product option visiblity condition type
Product option visiblity
A unique identifier associated with a specific value or choice within a product option.
{
"status": 201,
"success": true,
"data": {
"id": 1130246629,
"name": "size",
"description": null,
"type": "radio",
"required": false,
"associated_with_order_time": 0,
"sort": null,
"display_type": "text",
"visibility": "always",
"values": [
{
"id": 322122678,
"name": "XL",
"price": {
"amount": 180,
"currency": "SAR"
},
"display_value": "XL",
"option_id": 1130246629,
"image_url": "https://i.ibb.co/jyqRQfQ/avatar-male.webp",
"hashed_display_value": "XL"
}
],
"skus": [
{
"id": 652911549,
"price": {
"amount": 150,
"currency": "SAR"
},
"regular_price": {
"amount": 234,
"currency": "SAR"
},
"stock_quantity": 3000,
"barcode": "barcode-ABC",
"sku": "sku-variant-1551119600",
"related_option_values": [
667315336,
322122678
]
}
]
}
}