Product options allow customers to customize products before purchase. This endpoint enables you to create new options for your products, such as size, color, or other configurable features.
Creates a new option for a specific product.
Pass the following parameters in the HTTP request body according to your specified Content-Type
:
Parameter | Type | Required | Description |
---|---|---|---|
product_id* | integer | Yes | The unique identifier of the product that the option is associated with. |
option_name* | string | Yes | The name of the option as it will appear to customers. |
option_type | string | No | The type of option interface. Defaults to S (Select box) if not specified. |
required | string | No | Determines if customers must specify this option before adding the product to cart. Use Y for Yes and N for No. |
inventory | string | No | Determines if the option is taken into account when forming the product inventory. Use Y for Yes and N for No. |
main_pair | object | No | An object with the icons of the option variants. |
Code | Type | Description |
---|---|---|
S |
Select box | A dropdown list of options |
R |
Radiogroup | A group of radio buttons (select one) |
C |
Checkbox | A single checkbox option |
I |
Text (one line) | A text input field |
T |
Text area | A multi-line text input area |
F |
File | A file upload option |
For select boxes, radiogroups, and checkboxes, you can define variants as part of the request:
Parameter | Type | Required | Description |
---|---|---|---|
variants | object | No | An object containing the option variants. Each variant can have its own properties like name, price modifier, etc. |
{ "product_id": "12", "option_name": "Packaging", "option_type": "R", "required": "Y", "inventory": "N", "main_pair": { "icon": { "image_path": { "1": "https://www.venddor.com.br/image1.jpg", "2": "https://www.venddor.com.br/image2.jpg" } } }, "variants": { "1": { "variant_name": "None" }, "2": { "variant_name": "Gift wrap", "modifier_type": "A", "modifier": "5" } } }
This request creates a new "Packaging" option for the product with product_id=12
. The option has two variants:
modifier_type="A"
for absolute value)modifier_type
field, use A
for absolute value (like $5) and P
for percentage (like 10%).
{ "option_id": 27 }
Returned when the option couldn't be created due to invalid parameters or other issues.
Product options enhance your store by giving customers the ability to customize products. When creating options, consider the following best practices:
required
flag appropriately - only make options required if the product truly can't be sold without a selectioninventory=Y
setting, make sure to also create appropriate option combinations for inventory tracking