Documentation is still being updated. Some content maybe unfinished.
A valid request URL is required to generate request examples{
"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": []
}Gets a single product by ID or SKU.
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": []
}Unique identifier for the product (ID or SKU).
Product retrieved successfully.
CoCart v2 Product object with custom structure
Unique identifier for the product
Product parent ID
Product name
Product type
simple, grouped, external, variable Product slug
Product URL
Unique identifier (SKU)
Product description
Product short description
Whether the product is featured
Product pricing information
Show child attributes
Current product price
Product regular price
Product sale price (empty string if not on sale)
Price range for variable products (null for non-variable products)
Whether the product is on sale
Sale date information
Show child attributes
Show child attributes
Currency code.
Currency symbol.
Currency symbol position.
Currency minor unit.
Currency decimal separator.
Currency thousand separator.
Currency prefix.
Currency suffix.
Product conditional flags
Show child attributes
Whether the product is virtual
Whether the product is downloadable
Whether stock is managed at product level
Whether only one item can be bought in a single order
Whether reviews are allowed
Whether the product needs to be shipped
Average rating
Number of reviews
Number of ratings
Maximum rating value (formatted)
Product images
Show child attributes
Image ID
Image name
Image alternative text
Image position in gallery
Whether this is the featured image
Product attributes
Show child attributes
Attribute ID.
Attribute name.
Attribute position.
Define if the attribute is visible on the "Additional information" tab in the product's page.
Define if the attribute can be used as variation.
List of available term names of the attribute.
Full variation objects (not just IDs)
Show child attributes
Unique identifier for the variation
Product parent ID (the variable product this variation belongs to)
Variation name
Variation slug
Variation URL
Unique identifier (SKU)
Variation description
Variation dates
Whether the variation is featured
Variation pricing information
Show child attributes
Current variation price
Variation regular price
Variation sale price (empty string if not on sale)
Price range (null for variations)
Whether the variation is on sale
Sale date information
Show child attributes
Sale start date in local time
Sale start date in GMT
Sale end date in local time
Sale end date in GMT
Show child attributes
Currency code.
Currency symbol.
Currency symbol position.
Currency minor unit.
Currency decimal separator.
Currency thousand separator.
Currency prefix.
Currency suffix.
Variation conditional flags (note reviews_allowed is not present)
Show child attributes
Whether the variation is virtual
Whether the variation is downloadable
Whether stock is managed at variation level
Whether only one item can be bought in a single order
Whether the variation needs to be shipped
Variation images
Show child attributes
Image ID
Image name
Image alternative text
Image position in gallery
Whether this is the featured image
Variation attributes
Show child attributes
Attribute ID.
Attribute name.
Attribute position.
Define if the attribute is visible on the "Additional information" tab in the product's page.
Define if the attribute can be used as variation.
List of available term names of the attribute.
Stock information
Show child attributes
Whether the variation is in stock
Stock quantity (null if not managing stock)
Stock status
instock, outofstock, onbackorder If managing stock, this controls if backorders are allowed
no, notify, yes Whether backorders are allowed
Whether the variation is on backorder
Low stock threshold amount
Total number of sales for this variation
Add to cart information (note has_options is not present)
Show child attributes
Add to cart button text
Add to cart description
Whether the variation is purchasable
REST URL for adding this variation to cart
Grouped product IDs
Stock information
Show child attributes
Whether the product is in stock
Stock quantity (null if not managing stock)
Stock status
instock, outofstock, onbackorder If managing stock, this controls if backorders are allowed
no, notify, yes Whether backorders are allowed
Whether the product is on backorder
Low stock threshold amount
Product reviews (populated when show_reviews parameter is true)
Show child attributes
Unique identifier for the resource.
The date the review was created.
The date the review was created, as GMT.
Unique identifier for the product that the review belongs to.
Status of the review.
Name of the reviewer.
Email of the reviewer.
The content of the review.
Review rating (0 to 5).
Shows if the reviewer bought the product or not.
Related products with basic information
Show child attributes
Product ID
Product name
Product URL
Product price
REST URL for this product
Upsell products with basic information
Show child attributes
Product ID
Product name
Product URL
Product price
REST URL for this product
Cross-sell products with basic information
Show child attributes
Product ID
Product name
Product URL
Product price
REST URL for this product
Total number of sales
External product URL (for external product type)
External product button text (for external product type)
Add to cart information (CoCart-specific)
Show child attributes
Add to cart button text
Add to cart description
Whether the product has options
Whether the product is purchasable
REST URL for adding this product to cart
Was this page helpful?