Skip to main content
GET
/
products
/
{id}
/
variations
Get product variations
curl --request GET \
  --url {protocol}://{host}/wp-json/cocart/v2/products/{id}/variations
[
  {
    "id": 289,
    "parent_id": 278,
    "name": "Premium Cotton T-Shirt - Large, Navy Blue",
    "slug": "premium-cotton-t-shirt-large-navy-blue",
    "permalink": "https://example-store.com/product/premium-cotton-t-shirt/?attribute_pa_size=large&attribute_pa_color=navy-blue",
    "sku": "PCT-2024-L-NAVY",
    "description": "Premium Cotton T-Shirt in Large, Navy Blue",
    "dates": {
      "created": "2024-02-10T09:15:00",
      "created_gmt": "2024-02-10T14:15:00",
      "modified": "2024-09-18T11:45:00",
      "modified_gmt": "2024-09-18T16:45:00"
    },
    "featured": false,
    "prices": {
      "price": "80.00",
      "regular_price": "80.00",
      "sale_price": "",
      "price_range": null,
      "on_sale": false,
      "date_on_sale": {
        "from": null,
        "from_gmt": null,
        "to": null,
        "to_gmt": null
      },
      "currency": {
        "code": "USD",
        "symbol": "$",
        "position": "left",
        "decimal_separator": ".",
        "thousand_separator": ",",
        "decimals": 2
      }
    },
    "hidden_conditions": {
      "virtual": false,
      "downloadable": false,
      "manage_stock": true,
      "sold_individually": false,
      "shipping_required": true
    },
    "images": [
      {
        "id": 724,
        "src": {
          "thumbnail": "https://example-store.com/wp-content/uploads/2024/02/tshirt-navy-150x150.jpg",
          "medium": "https://example-store.com/wp-content/uploads/2024/02/tshirt-navy-300x300.jpg",
          "large": "https://example-store.com/wp-content/uploads/2024/02/tshirt-navy-600x600.jpg",
          "full": "https://example-store.com/wp-content/uploads/2024/02/tshirt-navy.jpg"
        },
        "name": "tshirt-navy",
        "alt": "Premium Cotton T-Shirt in Navy Blue",
        "position": 0,
        "featured": true
      }
    ],
    "categories": [
      {
        "id": 15,
        "name": "Clothing",
        "slug": "clothing",
        "rest_url": "https://example-store.com/wp-json/cocart/v2/products/categories/15"
      },
      {
        "id": 22,
        "name": "T-Shirts",
        "slug": "t-shirts",
        "rest_url": "https://example-store.com/wp-json/cocart/v2/products/categories/22"
      }
    ],
    "tags": [
      {
        "id": 8,
        "name": "Premium",
        "slug": "premium",
        "rest_url": "https://example-store.com/wp-json/cocart/v2/products/tags/8"
      }
    ],
    "attributes": [
      {
        "id": 1,
        "name": "Size",
        "position": 0,
        "visible": true,
        "variation": true,
        "options": [
          "Large"
        ]
      },
      {
        "id": 2,
        "name": "Color",
        "position": 1,
        "visible": true,
        "variation": true,
        "options": [
          "Navy Blue"
        ]
      }
    ],
    "stock": {
      "is_in_stock": true,
      "stock_quantity": 45,
      "stock_status": "instock",
      "backorders": "no",
      "backorders_allowed": false,
      "backordered": false,
      "low_stock_amount": null
    },
    "weight": {
      "value": "0.2",
      "unit": "kg"
    },
    "dimensions": {
      "length": "12",
      "width": "10",
      "height": "1",
      "unit": "cm"
    },
    "total_sales": 156,
    "add_to_cart": {
      "text": "Add to cart",
      "description": "Add Premium Cotton T-Shirt - Large, Navy Blue to your cart",
      "is_purchasable": true,
      "purchase_quantity": {
        "min_purchase": 1,
        "max_purchase": 45
      },
      "rest_url": "https://example-store.com/wp-json/cocart/v2/cart/add-item"
    },
    "meta_data": [
      {
        "key": "_fabric",
        "value": "100% Cotton"
      }
    ]
  },
  {
    "id": 290,
    "parent_id": 278,
    "name": "Premium Cotton T-Shirt - Medium, White",
    "slug": "premium-cotton-t-shirt-medium-white",
    "permalink": "https://example-store.com/product/premium-cotton-t-shirt/?attribute_pa_size=medium&attribute_pa_color=white",
    "sku": "PCT-2024-M-WHT",
    "description": "Premium Cotton T-Shirt in Medium, White",
    "dates": {
      "created": "2024-02-10T09:15:00",
      "created_gmt": "2024-02-10T14:15:00",
      "modified": "2024-09-18T11:45:00",
      "modified_gmt": "2024-09-18T16:45:00"
    },
    "featured": false,
    "prices": {
      "price": "25.00",
      "regular_price": "30.00",
      "sale_price": "25.00",
      "price_range": null,
      "on_sale": true,
      "date_on_sale": {
        "from": "2024-09-01T00:00:00",
        "from_gmt": "2024-09-01T05:00:00",
        "to": "2024-10-31T23:59:59",
        "to_gmt": "2024-11-01T04:59:59"
      },
      "currency": {
        "code": "USD",
        "symbol": "$",
        "position": "left",
        "decimal_separator": ".",
        "thousand_separator": ",",
        "decimals": 2
      }
    },
    "hidden_conditions": {
      "virtual": false,
      "downloadable": false,
      "manage_stock": true,
      "sold_individually": false,
      "shipping_required": true
    },
    "images": [
      {
        "id": 723,
        "src": {
          "thumbnail": "https://example-store.com/wp-content/uploads/2024/02/tshirt-white-150x150.jpg",
          "medium": "https://example-store.com/wp-content/uploads/2024/02/tshirt-white-300x300.jpg",
          "large": "https://example-store.com/wp-content/uploads/2024/02/tshirt-white-600x600.jpg",
          "full": "https://example-store.com/wp-content/uploads/2024/02/tshirt-white.jpg"
        },
        "name": "tshirt-white",
        "alt": "Premium Cotton T-Shirt in White",
        "position": 0,
        "featured": true
      }
    ],
    "categories": [
      {
        "id": 15,
        "name": "Clothing",
        "slug": "clothing",
        "rest_url": "https://example-store.com/wp-json/cocart/v2/products/categories/15"
      },
      {
        "id": 22,
        "name": "T-Shirts",
        "slug": "t-shirts",
        "rest_url": "https://example-store.com/wp-json/cocart/v2/products/categories/22"
      }
    ],
    "tags": [
      {
        "id": 8,
        "name": "Premium",
        "slug": "premium",
        "rest_url": "https://example-store.com/wp-json/cocart/v2/products/tags/8"
      }
    ],
    "attributes": [
      {
        "id": 1,
        "name": "Size",
        "position": 0,
        "visible": true,
        "variation": true,
        "options": [
          "Medium"
        ]
      },
      {
        "id": 2,
        "name": "Color",
        "position": 1,
        "visible": true,
        "variation": true,
        "options": [
          "White"
        ]
      }
    ],
    "stock": {
      "is_in_stock": true,
      "stock_quantity": 78,
      "stock_status": "instock",
      "backorders": "no",
      "backorders_allowed": false,
      "backordered": false,
      "low_stock_amount": null
    },
    "weight": {
      "value": "0.2",
      "unit": "kg"
    },
    "dimensions": {
      "length": "12",
      "width": "10",
      "height": "1",
      "unit": "cm"
    },
    "total_sales": 243,
    "add_to_cart": {
      "text": "Add to cart",
      "description": "Add Premium Cotton T-Shirt - Medium, White to your cart",
      "is_purchasable": true,
      "purchase_quantity": {
        "min_purchase": 1,
        "max_purchase": 78
      },
      "rest_url": "https://example-store.com/wp-json/cocart/v2/cart/add-item"
    },
    "meta_data": [
      {
        "key": "_fabric",
        "value": "100% Cotton"
      }
    ]
  }
]

Path Parameters

id
integer
required

Unique identifier for the variable product.

Query Parameters

page
integer
default:1

Current page of the collection.

per_page
integer
default:10

Maximum number of items to return per page.

Response

Product variations retrieved successfully.

id
integer

Unique identifier for the variation

parent_id
integer

Product parent ID (the variable product this variation belongs to)

name
string

Variation name

slug
string

Variation slug

Variation URL

sku
string

Unique identifier (SKU)

description
string

Variation description

dates
object

Variation dates

Whether the variation is featured

prices
object

Variation pricing information

hidden_conditions
object

Variation conditional flags (note reviews_allowed is not present)

images
object[]

Variation images

categories
object[]

Product categories (inherited from parent)

tags
object[]

Product tags (inherited from parent)

attributes
object[]

Variation attributes

stock
object

Stock information

weight
object

Variation weight

dimensions
object

Variation dimensions

total_sales
integer

Total number of sales for this variation

add_to_cart
object

Add to cart information (note has_options is not present)

meta_data
object[]

Meta data

I