Product Options

Overview

Products in Venddor can have options—additional properties that customers may select when buying a product. For example, for clothes that would be color, size, optional accessories, etc. Product options enable you to offer product variations and customizations without creating separate product entries.

Base URL: https://www.venddor.com.br/api/2.0/products/{product_id}/options

Option Types

Option Type Code Description
Select Box S A dropdown menu that allows customers to select one option from a list (e.g., size: S, M, L, XL)
Radio Group R A set of radio buttons that allows customers to select one option (e.g., color: Red, Blue, Green)
Checkbox C A checkbox that allows customers to include or exclude an option (e.g., Gift wrapping: Yes/No)
Input Field I A text field that allows customers to enter custom information (e.g., Custom engraving text)
Text Area T A multi-line text field for longer customer input (e.g., Special instructions)
File Upload F Allows customers to upload a file (e.g., Custom design image)
Date D A date picker for selecting dates (e.g., Delivery date)

Option Structure

{
  "option_id": "16",
  "product_id": "423",
  "option_name": "Color",
  "option_type": "S",
  "position": 10,
  "required": "Y",
  "comment": "Please select your preferred color",
  "inventory": "Y",
  "variants": [
    {
      "variant_id": "42",
      "variant_name": "Black",
      "position": 10,
      "modifier_type": "A", // A - absolute, P - percentage
      "modifier": "0.00",
      "weight_modifier": "0.00",
      "status": "A"
    },
    {
      "variant_id": "43",
      "variant_name": "White",
      "position": 20,
      "modifier_type": "A",
      "modifier": "0.00",
      "weight_modifier": "0.00",
      "status": "A"
    },
    {
      "variant_id": "44",
      "variant_name": "Red",
      "position": 30,
      "modifier_type": "A",
      "modifier": "5.00",
      "weight_modifier": "0.00",
      "status": "A"
    }
  ]
}

API Endpoints

GET /api/2.0/products/{product_id}/options

Retrieves all options associated with a specific product.

GET /api/2.0/products/{product_id}/options/{option_id}

Retrieves details for a specific product option.

POST /api/2.0/products/{product_id}/options

Creates a new option for a product.

PUT /api/2.0/products/{product_id}/options/{option_id}

Updates an existing product option.

DELETE /api/2.0/products/{product_id}/options/{option_id}

Deletes a product option.

Key Fields Explained

Option Fields

Variant Fields

Note: Only options with the inventory=Y attribute can be used for inventory tracking and in option combinations.

Best Practices

Tip: When creating options that affect inventory (with inventory=Y), make sure to also update your product option combinations to reflect the accurate stock levels for each possible combination.

Example: Creating a Size Option

POST /api/2.0/products/423/options

{
  "option_name": "Size",
  "option_type": "S",
  "position": 20,
  "required": "Y",
  "comment": "Please select your size",
  "inventory": "Y",
  "variants": [
    {
      "variant_name": "Small",
      "position": 10,
      "modifier_type": "A",
      "modifier": "0.00",
      "weight_modifier": "-0.20",
      "status": "A"
    },
    {
      "variant_name": "Medium",
      "position": 20,
      "modifier_type": "A",
      "modifier": "0.00",
      "weight_modifier": "0.00",
      "status": "A"
    },
    {
      "variant_name": "Large",
      "position": 30,
      "modifier_type": "A",
      "modifier": "2.00",
      "weight_modifier": "0.30",
      "status": "A"
    },
    {
      "variant_name": "Extra Large",
      "position": 40,
      "modifier_type": "A",
      "modifier": "5.00",
      "weight_modifier": "0.50",
      "status": "A"
    }
  ]
}

Working with Option Combinations

When you have multiple options with inventory tracking enabled, you need to manage the inventory for specific combinations of options. For example, you might have 10 "Blue" and "Small" shirts, but only 5 "Red" and "Large" shirts.

Option combinations are managed through a separate API endpoint:

GET /api/2.0/products/{product_id}/options/combinations

Retrieves all option combinations for a product.

POST /api/2.0/products/{product_id}/options/combinations

Creates a new option combination with inventory data.

Important: When a product has options with inventory=Y, you must create option combinations with specific inventory levels. Otherwise, customers won't be able to purchase the product with those option combinations.