跳到主要内容
将当前页面内容以 Markdown 格式复制到剪贴板

报告

报告 API 允许您查看所有类型的可用报告。

列出所有报告

此 API 允许您检索并查看一个简单的可用报告列表。

GET /wp-json/wc/v3/reports
curl https://example.com/wp-json/wc/v3/reports \
-u consumer_key:consumer_secret

获取销售报告

这个 API 允许您获取和查看一份销售报告。

GET /wp-json/wc/v3/reports/sales
curl https://example.com/wp-json/wc/v3/reports/sales?date_min=2016-05-03&date_max=2016-05-04 \
-u consumer_key:consumer_secret
Per-period refunds vs total_refunds

Per-period refunds and the top-level total_refunds come from different queries and will not always agree. Per-period refunds sum each refund record by its own date inside the report range. total_refunds instead counts the parent order's full total for any refunded-status order that has any refund record falling in the range. When an order's refunds straddle the range boundary (e.g. a partial refund last month and another this month on the same order that ultimately becomes refunded), the two values can diverge. For per-day net sales, prefer sales - refunds per bucket.

Sales report properties

AttributeTypeDescription
total_salesstringGross sales in the period. READ-ONLY
net_salesstringNet sales in the period. READ-ONLY
average_salesstringAverage net daily sales. READ-ONLY
total_ordersintegerTotal of orders placed. READ-ONLY
total_itemsintegerTotal of items purchased. READ-ONLY
total_taxstringTotal charged for taxes. READ-ONLY
total_shippingstringTotal charged for shipping. READ-ONLY
total_refundsintegerTotal of refunded orders. READ-ONLY
total_discountintegerTotal of coupons used. READ-ONLY
totals_grouped_bystringGroup type. READ-ONLY
totalsarrayTotals. READ-ONLY

Available parameters

ParameterTypeDescription
contextstringScope under which the request is made; determines fields present in response. Default is view. Options: view.
periodstringReport period. Default is today's date. Options: week, month, last_month and year
date_minstringReturn sales for a specific start date, the date need to be in the YYYY-MM-DD format.
date_maxstringReturn sales for a specific end date, the date need to be in the YYYY-MM-DD format.

Retrieve top sellers report

This API lets you retrieve and view a list of top sellers report.

GET /wp-json/wc/v3/reports/top_sellers
curl https://example.com/wp-json/wc/v3/reports/top_sellers?period=last_month \
-u consumer_key:consumer_secret

Top sellers report properties

AttributeTypeDescription
titlestringProduct title. READ-ONLY
product_idintegerProduct ID. READ-ONLY
quantityintegerTotal number of purchases. READ-ONLY

Available parameters

ParameterTypeDescription
contextstringScope under which the request is made; determines fields present in response. Default is view. Options: view.
periodstringReport period. Default is week. Options: week, month, last_month and year
date_minstringReturn sales for a specific start date, the date need to be in the YYYY-MM-DD format.
date_maxstringReturn sales for a specific end date, the date need to be in the YYYY-MM-DD format.

Retrieve coupons totals

This API lets you retrieve and view coupons totals report.

GET /wp-json/wc/v3/reports/coupons/totals
curl https://example.com/wp-json/wc/v3/reports/coupons/totals \
-u consumer_key:consumer_secret

优惠券总计属性

属性类型描述
slug字符串用于标识资源的字母数字标识符。只读
name字符串优惠券类型名称。只读
total字符串优惠券数量。只读

获取客户总计

此 API 允许您检索和查看客户总计报告。

GET /wp-json/wc/v3/reports/customers/totals
curl https://example.com/wp-json/wc/v3/reports/customers/totals \
-u consumer_key:consumer_secret

客户总计属性

属性类型描述
slug字符串用于标识资源的字母数字标识符。只读
name字符串客户类型名称。只读
total字符串客户数量。只读

获取订单总计

此 API 允许您检索和查看订单总计报告。

GET /wp-json/wc/v3/reports/orders/totals
curl https://example.com/wp-json/wc/v3/reports/orders/totals \
-u consumer_key:consumer_secret

订单总数属性

属性类型描述
slug字符串用于标识资源的字母数字标识符。只读
name字符串订单状态名称。只读
total字符串订单数量。只读

获取产品总数

此 API 允许您检索和查看产品总数报告。

GET /wp-json/wc/v3/reports/products/totals
curl https://example.com/wp-json/wc/v3/reports/products/totals \
-u consumer_key:consumer_secret

产品总计属性

属性类型描述
slug字符串用于标识资源的字母数字标识符。只读
name字符串产品类型名称。只读
total字符串产品数量。只读

获取评价总计

此 API 允许您检索和查看评价总计报告。

GET /wp-json/wc/v3/reports/reviews/totals
curl https://example.com/wp-json/wc/v3/reports/reviews/totals \
-u consumer_key:consumer_secret

Reviews totals properties

AttributeTypeDescription
slugstringAn alphanumeric identifier for the resource. READ-ONLY
namestringReview type name. READ-ONLY
totalstringAmount of reviews. READ-ONLY