Back to Woocommerce

Product Reviews API

docs/apis/store-api/resources-endpoints/product-reviews.md

10.8.0-dev3.3 KB
Original Source

Product Reviews API

List Product Reviews

This endpoint returns product reviews (comments) and can also show results from either specific products or specific categories.

http
GET /products/reviews
GET /products/reviews?category_id=1,2,3
GET /products/reviews?product_id=1,2,3
GET /products/reviews?orderby=rating&order=desc
AttributeTypeRequiredDescription
pageintegernoCurrent page of the collection.
per_pageintegernoMaximum number of items to be returned in result set.
offsetintegernoOffset the result set by a specific number of items.
orderstringnoOrder sort attribute ascending or descending. Allowed values: asc, desc
orderbystringnoSort collection by object attribute. Allowed values : date, date_gmt, id, rating, product
category_idstringnoLimit result set to reviews from specific category IDs.
product_idstringnoLimit result set to reviews from specific product IDs.
sh
curl "https://example-store.com/wp-json/wc/store/v1/products/collection-data?calculate_price_range=true&calculate_attribute_counts=pa_size,pa_color&calculate_rating_counts=true"

Example response:

json
[
	{
		"id": 83,
		"date_created": "2022-01-12T15:42:14",
		"formatted_date_created": "January 12, 2022",
		"date_created_gmt": "2022-01-12T15:42:14",
		"product_id": 33,
		"product_name": "Beanie with Logo",
		"product_permalink": "https://store.local/product/beanie-with-logo/",
		"product_image": {
			"id": 56,
			"src": "https://store.local/wp-content/uploads/2021/11/beanie-with-logo-1.jpg",
			"thumbnail": "https://store.local/wp-content/uploads/2021/11/beanie-with-logo-1-324x324.jpg",
			"srcset": "https://store.local/wp-content/uploads/2021/11/beanie-with-logo-1.jpg 800w, https://store.local/wp-content/uploads/2021/11/beanie-with-logo-1-324x324.jpg 324w, https://store.local/wp-content/uploads/2021/11/beanie-with-logo-1-100x100.jpg 100w, https://store.local/wp-content/uploads/2021/11/beanie-with-logo-1-416x416.jpg 416w, https://store.local/wp-content/uploads/2021/11/beanie-with-logo-1-300x300.jpg 300w, https://store.local/wp-content/uploads/2021/11/beanie-with-logo-1-150x150.jpg 150w, https://store.local/wp-content/uploads/2021/11/beanie-with-logo-1-768x768.jpg 768w",
			"sizes": "(max-width: 800px) 100vw, 800px",
			"name": "beanie-with-logo-1.jpg",
			"alt": ""
		},
		"reviewer": "reviewer-name",
		"review": "<p>This is a fantastic product.</p>\n",
		"rating": 5,
		"verified": true,
		"reviewer_avatar_urls": {
			"24": "https://secure.gravatar.com/avatar/12345?s=24&d=mm&r=g",
			"48": "https://secure.gravatar.com/avatar/12345?s=48&d=mm&r=g",
			"96": "https://secure.gravatar.com/avatar/12345?s=96&d=mm&r=g"
		}
	}
]