Skip to main content
GET
/
products
/
{id}
/
variations
/
{variation_id}
Get single product variation
curl --request GET \
  --url {protocol}://{host}/wp-json/cocart/v2/products/{id}/variations/{variation_id}
{
  "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"
    }
  ]
}

Path Parameters

id
integer
required

Unique identifier for the variable product.

variation_id
integer
required

Unique identifier for the variation.

Response

Product variation retrieved successfully.

CoCart v2 Product Variation object. Variations use the same structure as Product objects, but with the following fields removed: type, short_description, hidden_conditions.reviews_allowed, average_rating, review_count, rating_count, rated_out_of, reviews, default_attributes, variations, grouped_products, related, upsells, cross_sells, external_url, button_text, and add_to_cart.has_options.

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