Venddor API - Option Variants

Product Option Variants

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.

Applicable Options: Option variants are available for Selectbox and Radiogroup option types. Checkbox options have two predefined variants (checked/unchecked).

Option Variant Fields

The following table describes all available fields for option variants:

Basic Information

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.

Price Modifiers

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 currency
P — Percentage: change product price by certain percentage

Weight Modifiers

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 units
P — Percentage: change product weight by certain percentage

Reward Points (Add-on Feature)

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 amount
P — Percentage: change the number of points by certain percentage

Visual Elements

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.
Tip: Using price modifiers effectively can allow you to offer premium options at an additional cost. For example, you could add a $5 surcharge for oversized items using an absolute modifier, or add 10% to the price for premium materials using a percentage modifier.

Example Option Variant Objects

{
  "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"
  }
}
Note: The 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.

Working with Variant Modifiers

Modifiers allow you to adjust the price, weight, or reward points of a product based on the selected variant. Here's how they work:

Absolute Modifiers

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

Percentage Modifiers

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
Important: When using percentage modifiers, be cautious with large percentage values as they can significantly impact the final price. Consider using absolute modifiers for more predictable pricing.