Skip to main content
GET
/
products
/
{id}
Get single product
curl --request GET \
  --url {protocol}://{host}/wp-json/cocart/v2/products/{id}
{
  "id": 278,
  "parent_id": 0,
  "name": "Premium Cotton T-Shirt",
  "type": "variable",
  "slug": "premium-cotton-t-shirt",
  "permalink": "https://example-store.com/product/premium-cotton-t-shirt/",
  "sku": "PCT-2024",
  "description": "<p>Soft, breathable premium cotton t-shirt perfect for everyday wear.</p>",
  "short_description": "<p>Comfortable premium cotton t-shirt in various sizes and colors.</p>",
  "dates": {
    "created": "2024-02-10T09:15:00",
    "created_gmt": "2024-02-10T13:15:00",
    "modified": "2024-09-18T11:45:00",
    "modified_gmt": "2024-09-18T15:45:00"
  },
  "featured": false,
  "prices": {
    "price": "25.00",
    "regular_price": "25.00",
    "sale_price": "",
    "price_range": {
      "min": "25.00",
      "max": "35.00"
    },
    "on_sale": false,
    "date_on_sale": {
      "from": null,
      "from_gmt": null,
      "to": null,
      "to_gmt": null
    },
    "currency": {
      "currency_code": "USD",
      "currency_symbol": "$",
      "currency_minor_unit": 2,
      "currency_decimal_separator": ".",
      "currency_thousand_separator": ",",
      "currency_prefix": "$",
      "currency_suffix": ""
    }
  },
  "hidden_conditions": {
    "virtual": false,
    "downloadable": false,
    "manage_stock": false,
    "sold_individually": false,
    "reviews_allowed": true,
    "shipping_required": true
  },
  "average_rating": "4.8",
  "review_count": 234,
  "rating_count": 234,
  "rated_out_of": "5",
  "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-1024x1024.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
    },
    {
      "id": 724,
      "src": {
        "thumbnail": "https://example-store.com/wp-content/uploads/2024/02/tshirt-black-150x150.jpg",
        "medium": "https://example-store.com/wp-content/uploads/2024/02/tshirt-black-300x300.jpg",
        "large": "https://example-store.com/wp-content/uploads/2024/02/tshirt-black-1024x1024.jpg",
        "full": "https://example-store.com/wp-content/uploads/2024/02/tshirt-black.jpg"
      },
      "name": "tshirt-black",
      "alt": "Premium Cotton T-Shirt in Black",
      "position": 1,
      "featured": false
    }
  ],
  "categories": [
    {
      "id": 23,
      "name": "Clothing",
      "slug": "clothing",
      "rest_url": "https://example-store.com/wp-json/cocart/v2/products/categories/23"
    },
    {
      "id": 28,
      "name": "T-Shirts",
      "slug": "t-shirts",
      "rest_url": "https://example-store.com/wp-json/cocart/v2/products/categories/28"
    }
  ],
  "tags": [
    {
      "id": 51,
      "name": "Cotton",
      "slug": "cotton",
      "rest_url": "https://example-store.com/wp-json/cocart/v2/products/tags/51"
    },
    {
      "id": 89,
      "name": "Casual",
      "slug": "casual",
      "rest_url": "https://example-store.com/wp-json/cocart/v2/products/tags/89"
    }
  ],
  "attributes": {
    "attribute_size": {
      "id": 1,
      "name": "Size",
      "position": 0,
      "is_attribute_visible": true,
      "used_for_variation": true,
      "options": {
        "small": "Small",
        "medium": "Medium",
        "large": "Large",
        "x-large": "X-Large"
      }
    },
    "attribute_color": {
      "id": 2,
      "name": "Color",
      "position": 1,
      "is_attribute_visible": true,
      "used_for_variation": true,
      "options": {
        "white": "White",
        "black": "Black",
        "navy-blue": "Navy Blue",
        "gray": "Gray"
      }
    }
  },
  "default_attributes": {
    "attribute_size": {
      "id": 1,
      "name": "Size",
      "option": {
        "medium": "Medium"
      }
    },
    "attribute_color": {
      "id": 2,
      "name": "Color",
      "option": {
        "white": "White"
      }
    }
  },
  "variations": [
    {
      "id": 289,
      "sku": "PCT-2024-SM-WHT",
      "description": "Small White T-Shirt",
      "attributes": {
        "attribute_size": "small",
        "attribute_color": "white"
      },
      "featured_image": {
        "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-1024x1024.jpg",
        "full": "https://example-store.com/wp-content/uploads/2024/02/tshirt-white.jpg"
      },
      "prices": {
        "price": "25.00",
        "regular_price": "25.00",
        "sale_price": "",
        "on_sale": false,
        "date_on_sale": {
          "from": null,
          "from_gmt": null,
          "to": null,
          "to_gmt": null
        },
        "currency": {
          "currency_code": "USD",
          "currency_symbol": "$",
          "currency_minor_unit": 2,
          "currency_decimal_separator": ".",
          "currency_thousand_separator": ",",
          "currency_prefix": "$",
          "currency_suffix": ""
        }
      },
      "stock": {
        "is_in_stock": true,
        "stock_quantity": 50,
        "stock_status": "instock",
        "backorders": "no",
        "backorders_allowed": false,
        "backordered": false,
        "low_stock_amount": null
      },
      "add_to_cart": {
        "is_purchasable": true,
        "purchase_quantity": {
          "min_purchase": 1,
          "max_purchase": 50
        },
        "rest_url": "https://example-store.com/wp-json/cocart/v2/cart/add-item?id=289&quantity=1&variation[attribute_size]=small&variation[attribute_color]=white"
      }
    },
    {
      "id": 290,
      "sku": "PCT-2024-LG-BLK",
      "description": "Large Black T-Shirt",
      "attributes": {
        "attribute_size": "large",
        "attribute_color": "black"
      },
      "featured_image": {
        "thumbnail": "https://example-store.com/wp-content/uploads/2024/02/tshirt-black-150x150.jpg",
        "medium": "https://example-store.com/wp-content/uploads/2024/02/tshirt-black-300x300.jpg",
        "large": "https://example-store.com/wp-content/uploads/2024/02/tshirt-black-1024x1024.jpg",
        "full": "https://example-store.com/wp-content/uploads/2024/02/tshirt-black.jpg"
      },
      "prices": {
        "price": "28.00",
        "regular_price": "28.00",
        "sale_price": "",
        "on_sale": false,
        "date_on_sale": {
          "from": null,
          "from_gmt": null,
          "to": null,
          "to_gmt": null
        },
        "currency": {
          "currency_code": "USD",
          "currency_symbol": "$",
          "currency_minor_unit": 2,
          "currency_decimal_separator": ".",
          "currency_thousand_separator": ",",
          "currency_prefix": "$",
          "currency_suffix": ""
        }
      },
      "stock": {
        "is_in_stock": true,
        "stock_quantity": 35,
        "stock_status": "instock",
        "backorders": "no",
        "backorders_allowed": false,
        "backordered": false,
        "low_stock_amount": null
      },
      "add_to_cart": {
        "is_purchasable": true,
        "purchase_quantity": {
          "min_purchase": 1,
          "max_purchase": 35
        },
        "rest_url": "https://example-store.com/wp-json/cocart/v2/cart/add-item?id=290&quantity=1&variation[attribute_size]=large&variation[attribute_color]=black"
      }
    }
  ],
  "grouped_products": [],
  "stock": {
    "is_in_stock": true,
    "stock_quantity": null,
    "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"
  },
  "reviews": [],
  "related": [
    {
      "id": 301,
      "name": "Classic Polo Shirt",
      "permalink": "https://example-store.com/product/classic-polo-shirt/",
      "price": "32.00",
      "add_to_cart": {
        "text": "Select options",
        "description": "Variable product",
        "rest_url": "https://example-store.com/wp-json/cocart/v2/cart/add-item?id=301&quantity=1"
      },
      "rest_url": "https://example-store.com/wp-json/cocart/v2/products/301"
    }
  ],
  "upsells": [],
  "cross_sells": [],
  "total_sales": 567,
  "external_url": "",
  "button_text": "",
  "add_to_cart": {
    "text": "Select options",
    "description": "Variable product",
    "has_options": true,
    "is_purchasable": true,
    "purchase_quantity": {},
    "rest_url": "https://example-store.com/wp-json/cocart/v2/cart/add-item?id=278&quantity=1"
  },
  "meta_data": []
}

Path Parameters

id
string
required

Unique identifier for the product (ID or SKU).

Response

Product retrieved successfully.

CoCart v2 Product object with custom structure

id
integer

Unique identifier for the product

parent_id
integer

Product parent ID

name
string

Product name

type
enum<string>

Product type

Available options:
simple,
grouped,
external,
variable
slug
string

Product slug

Product URL

sku
string

Unique identifier (SKU)

description
string

Product description

short_description
string

Product short description

dates
object

Product dates

Whether the product is featured

prices
object

Product pricing information

hidden_conditions
object

Product conditional flags

average_rating
string

Average rating

review_count
integer

Number of reviews

rating_count
integer

Number of ratings

rated_out_of
string

Maximum rating value (formatted)

images
object[]

Product images

categories
object[]

Product categories

tags
object[]

Product tags

attributes
object[]

Product attributes

default_attributes
object[]

Default variation attributes

variations
object[]

Full variation objects (not just IDs)

grouped_products
integer[]

Grouped product IDs

stock
object

Stock information

weight
object

Product weight

dimensions
object

Product dimensions

reviews
object[]

Product reviews (populated when show_reviews parameter is true)

Related products with basic information

upsells
object[]

Upsell products with basic information

cross_sells
object[]

Cross-sell products with basic information

total_sales
integer

Total number of sales

external_url
string

External product URL (for external product type)

button_text
string

External product button text (for external product type)

add_to_cart
object

Add to cart information (CoCart-specific)

meta_data
object[]

Meta data

I