Option variants provide different choices for customers when selecting product options. For example, a "Size" option might have variants like "Small," "Medium," and "Large." This documentation explains how to work with option variants in the Venddor API.
Selectbox
and Radiogroup
option types. Checkbox
options have two predefined variants (checked/unchecked).
The following table describes all available fields for option variants:
Field | Values | Description |
---|---|---|
variant_id | integer | A unique identifier of the option variant. |
option_id | integer | The ID of the option that the variant is associated with. |
variant_name | string | The name of the option variant as displayed to customers (e.g., "Small", "Red", "Cotton"). |
position | integer | The position of the variant among other variants. The lower this number, the higher the variant appears on the list of variants in the Administration panel. |
Field | Values | Description |
---|---|---|
modifier | float | The price modifier of the option variant. This value adjusts the product's base price when this variant is selected. |
modifier_type | string |
The type of the price modifier:A — Absolute: change product price by a fixed amount in the store's primary currencyP — Percentage: change product price by certain percentage
|
Field | Values | Description |
---|---|---|
weight_modifier | float | The weight modifier of the option variant. This value adjusts the product's base weight when this variant is selected. |
weight_modifier_type | string |
The type of the weight modifier:A — Absolute: change product weight by a fixed amount in the store's weight measurement unitsP — Percentage: change product weight by certain percentage
|
Field | Values | Description |
---|---|---|
point_modifier | float | The reward point modifier of the option variant. This value adjusts the product's reward points when this variant is selected. |
point_modifier_type | string |
The type of the reward point modifier:A — Absolute: change the number of points by a fixed amountP — Percentage: change the number of points by certain percentage
|
Field | Values | Description |
---|---|---|
image_pair | object | The information about the image associated with the option variant. This can be useful for visually representing options like colors or patterns. |
{ "16": { "variant_id": "16", "option_id": "42", "variant_name": "Small", "position": "10", "modifier": "0.00", "modifier_type": "A", "weight_modifier": "0.00", "weight_modifier_type": "A" }, "17": { "variant_id": "17", "option_id": "42", "variant_name": "Medium", "position": "20", "modifier": "0.00", "modifier_type": "A", "weight_modifier": "0.00", "weight_modifier_type": "A" }, "18": { "variant_id": "18", "option_id": "42", "variant_name": "Large", "position": "30", "modifier": "0.00", "modifier_type": "A", "weight_modifier": "0.50", "weight_modifier_type": "A" }, "19": { "variant_id": "19", "option_id": "42", "variant_name": "X-Large", "position": "40", "modifier": "2.50", "modifier_type": "A", "weight_modifier": "1.00", "weight_modifier_type": "A", "point_modifier": "5.00", "point_modifier_type": "A" } }
Reward Points
add-on allows your customers to earn points for purchasing products. These points can later be used to pay for other products. The point_modifier
and point_modifier_type
fields are only available when this add-on is active.
Modifiers allow you to adjust the price, weight, or reward points of a product based on the selected variant. Here's how they work:
When using absolute modifiers (modifier_type="A"
), the specified value is added to the base product value:
// Base product price: $25.00 // Variant with modifier: "5.00" and modifier_type: "A" Final price = $25.00 + $5.00 = $30.00
When using percentage modifiers (modifier_type="P"
), the specified percentage is applied to the base product value:
// Base product price: $25.00 // Variant with modifier: "10.00" and modifier_type: "P" Final price = $25.00 + ($25.00 * 10%) = $25.00 + $2.50 = $27.50