VitePOS Bridge icon

VitePOS Bridge

Use VitePOS automation bridge and analytics APIs

Analytics → Get Product Analytics

AI-generated

Summary

Fetches sales analytics for a single product from the VitePOS analytics API (GET /wp-json/vtpl/v1/analytics/products/{id}), returning quantity sold, revenue, average price and profit for the chosen date range.

Inputs

  • Product ID (required) — ID of the product to analyze; inserted into the request path.
  • Range — Preset time window: today, yesterday, last_7_days, last_30_days, this_month (default), last_month, this_year, last_year, or custom. Sent as the range query parameter.
  • Period — Grouping granularity: day (default), week, month, or year. Sent as period.
  • Analytics Filters — Optional collection sent as query parameters: Category ID, Customer ID, Date From / Date To (trimmed to YYYY-MM-DD; use with Range = Custom Dates), Group By (product/parent), Include Orders and Include Returns (sent as 1/0), Limit, Month (e.g. 2026-06), Order (asc/desc), Order Statuses (comma-separated, e.g. wc-completed), Product ID, Sort (profit, revenue, quantity_sold, average_price). Only filters you add are sent.

Output shape

One JSON item per input item: the API response object, plus a response field containing a readable summary sentence such as 'Product analytics for : quantity X, revenue Y, average price Z, profit W.'

The summary reads quantity_sold, revenue, average_price and profit from the report/summary in the response; the full raw API fields are spread alongside it. If the API returns status/success false, response holds its message. If the response already has a response key or isn't an object, it is wrapped under raw. With Continue On Fail, errors are returned as {error: message}. The summary uses date_from/date_to from the response's filters, otherwise it says 'the selected period'.

Examples

Example 1: Monthly performance of one product

Product ID = 123, Range = This Month, Period = Day.

Example 2: Product performance over a specific date window

Product ID = 123, Range = Custom Dates, Analytics Filters: Date From = 2026-01-01, Date To = 2026-03-31, Period = Month.

Example 3: Completed-sales-only view excluding returns

Product ID = 123, Range = Last 30 Days, Filters: Order Statuses = wc-completed, Include Returns = false.

Links

Discussion