Skip to main content

Products API

List Products

GET /ec/v1/products

Parameters

ParameterTypeDefaultDescription
pageint1Page number
per_pageint12Items per page
searchstringSearch term
categoryintCategory ID filter
brand_idsstringComma-separated brand IDs
orderbystringdateSort field: date, price, title, popularity
orderstringdescSort direction: asc, desc
min_pricefloatMinimum price filter
max_pricefloatMaximum price filter

Response

{
"success": true,
"data": {
"items": [
{
"id": 1,
"title": "Product Name",
"slug": "product-name",
"price": "29.99",
"sale_price": null,
"sku": "PROD-001",
"stock_status": "in_stock",
"stock_quantity": 50,
"featured_image": "https://...",
"categories": [{ "id": 1, "name": "Category" }],
"created_at": "2026-01-15T10:30:00Z"
}
],
"total": 150,
"pages": 13
}
}

Get Single Product

GET /ec/v1/products/{id}

Returns full product details including variants, gallery images, and description.

Create Product

POST /ec/v1/products

Requires admin authentication.

Body

{
"title": "New Product",
"description": "Full description here",
"short_description": "Brief summary",
"price": "39.99",
"sale_price": "29.99",
"sku": "NEW-001",
"stock_quantity": 100,
"category_ids": [1, 3],
"featured_image_id": 42
}

Update Product

PUT /ec/v1/products/{id}

Partial updates supported — only send fields that changed.

Delete Product

DELETE /ec/v1/products/{id}

Requires admin authentication. Returns 204 on success.

Hooks

These filters are applied during API responses:

  • wpec_api_product_response — Transform individual product response
  • wpec_api_products_response — Transform product list response
  • wpec_product_query_args — Modify the underlying database query