Skip to main content
GET
/
products
{
  "products": [
    {
      "id": 145,
      "parent_id": 0,
      "name": "Wireless Bluetooth Headphones",
      "type": "simple",
      "slug": "wireless-bluetooth-headphones",
      "permalink": "https://example-store.com/product/wireless-bluetooth-headphones/",
      "sku": "WBH-2024-BLU",
      "description": "<p>Experience premium sound quality with our wireless Bluetooth headphones.</p>",
      "short_description": "<p>Premium wireless headphones with active noise cancellation.</p>",
      "dates": {
        "created": "2024-03-15T10:30:00",
        "created_gmt": "2024-03-15T14:30:00",
        "modified": "2024-09-20T14:22:00",
        "modified_gmt": "2024-09-20T18:22:00"
      },
      "featured": true,
      "prices": {
        "price": "18.00",
        "regular_price": "24.00",
        "sale_price": "18.00",
        "price_range": null,
        "on_sale": true,
        "date_on_sale": {
          "from": "2024-09-01T00:00:00",
          "from_gmt": "2024-09-01T04:00:00",
          "to": "2024-12-31T23:59:59",
          "to_gmt": "2024-12-31T03:59:59"
        },
        "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": true,
        "sold_individually": false,
        "reviews_allowed": true,
        "shipping_required": true
      },
      "average_rating": "4.7",
      "review_count": 89,
      "rating_count": 89,
      "rated_out_of": "5",
      "images": [
        {
          "id": 891,
          "src": {
            "thumbnail": "https://example-store.com/wp-content/uploads/2024/03/headphones-blue-150x150.jpg",
            "medium": "https://example-store.com/wp-content/uploads/2024/03/headphones-blue-300x300.jpg",
            "large": "https://example-store.com/wp-content/uploads/2024/03/headphones-blue-1024x1024.jpg",
            "full": "https://example-store.com/wp-content/uploads/2024/03/headphones-blue.jpg"
          },
          "name": "headphones-blue",
          "alt": "Wireless Bluetooth Headphones in Blue",
          "position": 0,
          "featured": true
        }
      ],
      "categories": [
        {
          "id": 15,
          "name": "Electronics",
          "slug": "electronics",
          "rest_url": "https://example-store.com/wp-json/cocart/v2/products/categories/15"
        }
      ],
      "tags": [
        {
          "id": 42,
          "name": "Wireless",
          "slug": "wireless",
          "rest_url": "https://example-store.com/wp-json/cocart/v2/products/tags/42"
        }
      ],
      "attributes": [],
      "default_attributes": [],
      "variations": [],
      "grouped_products": [],
      "stock": {
        "is_in_stock": true,
        "stock_quantity": 87,
        "stock_status": "instock",
        "backorders": "no",
        "backorders_allowed": false,
        "backordered": false,
        "low_stock_amount": null
      },
      "weight": {
        "value": "0.75",
        "unit": "kg"
      },
      "dimensions": {
        "length": "8",
        "width": "7",
        "height": "3.5",
        "unit": "cm"
      },
      "reviews": [],
      "related": [
        {
          "id": 156,
          "name": "Wireless Earbuds",
          "permalink": "https://example-store.com/product/wireless-earbuds/",
          "price": "12.00",
          "add_to_cart": {
            "text": "Add to cart",
            "description": "Add to cart description",
            "rest_url": "https://example-store.com/wp-json/cocart/v2/cart/add-item?id=156&quantity=1"
          },
          "rest_url": "https://example-store.com/wp-json/cocart/v2/products/156"
        }
      ],
      "upsells": [],
      "cross_sells": [],
      "total_sales": 342,
      "external_url": "",
      "button_text": "",
      "add_to_cart": {
        "text": "Add to cart",
        "description": "Simple product",
        "has_options": false,
        "is_purchasable": true,
        "purchase_quantity": {
          "min_purchase": 1,
          "max_purchase": 87
        },
        "rest_url": "https://example-store.com/wp-json/cocart/v2/cart/add-item?id=145&quantity=1"
      },
      "meta_data": []
    }
  ],
  "page": 1,
  "total_pages": 5,
  "total_products": 42
}

Query Parameters

page
integer
default:1

Current page of the collection.

per_page
integer
default:10

Maximum number of items to return per page.

Required range: x <= 100

Limit results to those matching a search string.

category
string

Limit results to products in specific categories.

tag
string

Limit results to products with specific tags.

type
enum<string>

Limit results to products of specific type.

Available options:
simple,
grouped,
external,
variable

Limit results to featured products.

on_sale
boolean

Limit results to products on sale.

min_price
string

Limit results to products with price greater than or equal to this value.

max_price
string

Limit results to products with price less than or equal to this value.

stock_status
enum<string>

Limit results to products with specified stock status.

Available options:
instock,
outofstock,
onbackorder
orderby
enum<string>
default:date

Sort products by field.

Available options:
date,
id,
include,
title,
slug,
price,
popularity,
rating,
menu_order,
alphabetical,
reverse_alpha,
relevance,
rand,
by_stock,
review_count,
on_sale_first,
featured_first,
price_asc,
price_desc,
sales
order
enum<string>
default:DESC

Sort order.

Available options:
ASC,
DESC
slug
string

Limit result set to products with a specific slug.

after
string<date-time>

Limit response to products created after a given ISO8601 compliant date.

before
string<date-time>

Limit response to products created before a given ISO8601 compliant date.

sku
string

Limit result set to products with specific SKU(s). Use commas to separate.

hide_free
boolean
default:false

Limit result set to hide free products.

category_operator
enum<string>
default:in

Operator to compare product category terms.

Available options:
in,
not_in,
and
tag_operator
enum<string>
default:in

Operator to compare product tags.

Available options:
in,
not_in,
and
brand
string

Limit result set to products assigned a set of brand IDs or slugs, separated by commas.

brand_operator
enum<string>
default:in

Operator to compare product brand terms.

Available options:
in,
not_in,
and
show_reviews
boolean
default:false

Returns product reviews for all products or an individual product.

return_variations
boolean
default:false

Returns all variations for variable products.

attribute_relation
enum<string>
default:and

The logical relationship between attributes when filtering across multiple at once.

Available options:
in,
and
catalog_visibility
enum<string>
default:visible

Determines if hidden or visible catalog products are shown.

Available options:
any,
visible,
catalog,
search,
hidden
rating
enum<integer>[]

Limit result set to products with a certain average rating.

offset
integer

Offset the result set by a specific number of items.

include
integer[]

Limit result set to specific IDs.

exclude
integer[]

Ensure result set excludes specific IDs.

parent
integer[]

Limit result set to those of particular parent IDs.

parent_exclude
integer[]

Limit result set to exclude particular parent IDs.

Response

Products retrieved successfully.

CoCart v2 Products collection response with pagination

products
object[]

Array of products

page
integer

Current page number

total_pages
integer

Total number of pages

total_products
integer

Total number of products

I