Visit Main Site
Join Partner Program
Login
     
Introduction
Authentication
Documentation
Category
GET
POST
PUT
DELETE
Products
GET
POST
PUT
DELETE
Carts
GET
POST
PATCH
DELETE
Variations
GET
POST
PUT
DELETE
Currency
GET
POST
PUT
DELETE
Tax
Tax Profile
GET
POST
PUT
DELETE
Tax Rule
GET
POST
PUT
DELETE
Tax Code
GET
POST
PUT
DELETE
Tax Zone
GET
POST
PUT
DELETE
Discount
GET
POST
PUT
DELETE
Shipping
Shipping Profile
GET
POST
PUT
DELETE
Shipping Rate
GET
POST
PUT
DELETE
Shipping Rules
GET
POST
PUT
DELETE
Customer
GET
POST
PUT
DELETE
Orders
GET
POST
PATCH
Blog
GET
POST
PUT
DELETE
Settings
GET
» Variation POST API Documentation

Creating Variation

Endpoint: POST /admin/variations

Purpose

The POST/admin/variations is used to create a new product variation along with its corresponding options. A variation defines a customizable product attribute such as size, color, material, etc. Each option includes display labels, values, display order, default status, and can include an image reference. This endpoint helps administrators set up new configurable attributes for products to enable flexible product customization.

Path Parameters

No path parameters for this endpoint.

Query Parameters

No query parameters for this endpoint.

Use Case

Administrators use this endpoint to define a new variation and add its available options. Each option is set with values like label, order, and default status. Once created, the system assigns unique IDs to the variation and its options, including auto-generated values or references. This API is crucial for expanding product configuration and enabling customer-facing customization on the storefront.

Request Body

Parameter
Type
Description
name
String
The name of the variation.
standard
String
The type of input for the variation (text).
is_disposable
Boolean
Indicates whether the variation can be discarded after use.
options
Array
A list of variation options.
JSON
{
  "variation": {
    "name": "VARIATION_NAME",
    "standard": "VARIATION_STANDARD",
    "is_disposable": "VARIATION_IS_DISPOSABLE",
    "options": [
      {
        "id": "VARIATION_OPTION_ID_1",
        "label": "VARIATION_OPTION_LABEL_1",
        "value": "VARIATION_OPTION_VALUE_1",
        "order": "VARIATION_OPTION_ORDER_1",
        "default": "VARIATION_OPTION_DEFAULT_1"
      },
      {
        "id": "VARIATION_OPTION_ID_2",
        "label": "VARIATION_OPTION_LABEL_2",
        "value": "VARIATION_OPTION_VALUE_2",
        "order": "VARIATION_OPTION_ORDER_2",
        "default": "VARIATION_OPTION_DEFAULT_2"
      }
    ]
  }
}

Response

The response returns a structured variation object containing the newly created variation's unique ID, name, input type (standard), and a flag indicating whether it's disposable. It also includes an array of variation options, each with details such as option ID, label, value, display order, whether it is the default selection, and its associated image (if any). This response helps confirm successful creation and allows the client to immediately reflect the variation in the UI or use it in product configurations.

POST
https://{your_site_domain}/api/v4/admin/variations
Try It Out
JSON
{
  "variation": {
    "id": "VARIATION_ID",
    "name": "VARIATION_NAME",
    "standard": "VARIATION_STANDARD",
    "is_disposable": "VARIATION_IS_DISPOSABLE",
    "options": [
      {
        "id": "VARIATION_OPTION_ID_1",
        "label": "VARIATION_OPTION_LABEL_1",
        "value": "VARIATION_OPTION_VALUE_1",
        "order": "VARIATION_OPTION_ORDER_1",
        "default": "VARIATION_OPTION_DEFAULT_1",
        "image": "VARIATION_OPTION_IMAGE_1"
      },
      {
        "id": "VARIATION_OPTION_ID_2",
        "label": "VARIATION_OPTION_LABEL_2",
        "value": "VARIATION_OPTION_VALUE_2",
        "order": "VARIATION_OPTION_ORDER_2",
        "default": "VARIATION_OPTION_DEFAULT_2",
        "image": "VARIATION_OPTION_IMAGE_2"
      }
    ]
  }
}
Terms and Conditions
Privacy Policy

© 2024 WebCommander | All Rights Reserved

contact@webcommander.com
1300 797 571

WebCommander
About Us
Features
Pricing
Compare
Partners
Contact Us
Resource
Find a Partner
Help Centre
Community
Blog
Solutions
Inventory Management
Omnichannel Sales
Ecommerce Automation
B2B Ecommerce
Headless Commerce
Website Design and Performance