Overview
Product variants allow products to have multiple variations with different attributes (e.g., color, size), pricing adjustments, and individual stock tracking. Variants inherit properties from their parent product.Variant Attributes
Variants are defined by their attributes, which are specific characteristics that differentiate them from other variants of the same product.Common Attribute Types
- Color: Red, Blue, Black, White, etc.
- Size: Small, Medium, Large, XL, etc.
- Material: Cotton, Polyester, Leather, etc.
- Storage: 64GB, 128GB, 256GB, etc.
- Style: Slim Fit, Regular Fit, Loose Fit, etc.
Get Product Attributes
Retrieve all available attributes for a specific product.Authentication
This endpoint does not require authentication. It is publicly accessible.Path Parameters
The unique identifier of the product
Response
Returns an array of attribute objects available for the product.Unique attribute identifier
Attribute name (e.g., “Color”, “Size”, “Storage”)
Request Example
Response Example
200 OK
Error Responses
Product with the specified ID does not exist
Variant Structure
Variants are included in the product details response when you retrieve a specific product. See the example below:Variant Fields
Unique variant identifier
Stock Keeping Unit - unique identifier for inventory tracking
- Must be unique across all variants
- Format example:
PROD-COLOR-SIZE(e.g.,WH-BLK-L)
Indicates if this is the default variant for the product
- Only one variant per product can be default
- Standalone products must have exactly one default variant
Amount to add to the product’s base price (decimal format)
- Can be positive (premium variant) or negative (discounted variant)
- Example:
"10.00"means this variant costs $10 more than base price - Final price = base_price + price_adjustment
Current available stock quantity for this variant
- Must be non-negative
- When stock reaches 0, the variant becomes unavailable
- Product’s total_stock_level is sum of all variant stock levels
Total number of units sold for this variant
- Used for popularity tracking and sorting
- Automatically incremented when orders are placed
- Product’s total_sold is sum of all variant quantities sold
Whether this variant is active and available for purchase
- Inactive variants are hidden from product listings
- Set to false to temporarily disable a variant
ISO 8601 timestamp of variant creation
ISO 8601 timestamp of last update
Array of attribute-value pairs that define this variant
Variant Pricing Example
- Red Small T-Shirt: 0.00)
- Blue XL T-Shirt: 3.00)
Get Product Variants
Variants are included when retrieving product details.Response Example with Variants
200 OK
Variant Rules and Constraints
General Rules
- SKU Uniqueness: Each variant must have a unique SKU across all products
- Attribute Uniqueness: Each variant must have a unique combination of attribute values
- Default Variant: Products can have one default variant
- Standalone Products: Products marked as
is_standalone=Truecan only have one default variant
Stock Management
- Automatic Updates: Product
total_stock_levelandis_availableare automatically updated when variant stock changes - Availability: A product is available if
total_stock_level > 0 - Stock Synchronization: Changing variant stock levels triggers product-level stock updates
Pricing
- Final Price Calculation:
final_price = product.base_price + variant.price_adjustment - Negative Adjustments: Price adjustments can be negative for discounted variants
- Offer Application: Active product offers are applied on top of the final variant price
- Minimum Price: Final price cannot be negative after adjustments
Best Practices
- SKU Format: Use a consistent SKU naming convention (e.g.,
PRODUCT-ATTR1-ATTR2) - Default Selection: Set the most popular variant as default
- Stock Monitoring: Regularly check stock levels to prevent overselling
- Attribute Naming: Use clear, customer-facing attribute names
- Price Consistency: Keep price adjustments reasonable relative to base price
Common Use Cases
Clothing Products
Electronics Products
Standalone Products
Notes
- Variants are ordered by
quantity_soldin descending order - Inactive variants (
is_active=False) are excluded from customer-facing displays - Product rating is shared across all variants
- Media files are associated with the product, not individual variants
- Variant stock updates automatically recalculate product-level totals
- Each variant must have a unique combination of attributes within a product