Skip to main content

Products Endpoints

Extends WooCommerce Products controller to support appointments data and staff filters.

Endpoints

List Products

GET /wc-appointments/v1/products

Get a collection of appointable products.

Permissions: Public read for published products. Admin for mutations (handled by Woo core controller).

Parameters (additions to WooCommerce Products):

ParameterTypeDescription
staffarray<int>|intFilter products by associated staff ID(s)

Default Behavior:

  • status = publish
  • type = appointment (filters to appointment products only)

Response Data (appointment additions):

  • has_price_label (bool)
  • pricing (array)
  • qty (int)
  • qty_basis (string: slot or day)
  • duration (int)
  • interval (int)
  • padding (int)
  • min_date (int, days from today)
  • max_date (int, days from today)
  • cancel_limit (int, hours)
  • reschedule_limit (int, hours)
  • requires_confirmation (bool)
  • customer_timezones (bool)
  • cal_color (string)
  • availability_span (int)
  • availability_autoselect (bool)
  • availability (array)
  • has_restricted_days (bool)
  • restricted_days (array)
  • staff_label (string)
  • staff_assignment (string)
  • staff_nopref (bool)
  • staff_ids (array<int>)
  • staff_base_costs (array)
  • staff_qtys (array)

Notes:

  • Staff filtering joins wc_appointment_relationships table to match products by staff
  • All standard WooCommerce Products fields are also included
  • When qty_basis = day, capacity is enforced per calendar day (per staff when staff are assigned) and spans deduct from every day they cover

Get Single Product

GET /wc-appointments/v1/products/{id}

Get a single appointable product by ID.

Permissions: Public read for published products.

Response: Same fields as list endpoint, single object.

Example Request:

GET /wp-json/wc-appointments/v1/products?staff=5&status=publish

Example Response:

[
{
"id": 123,
"name": "Haircut",
"type": "appointment",
"status": "publish",
"price": "50.00",
"duration": 60,
"duration_unit": "minute",
"interval": 0,
"padding": 0,
"min_date": 0,
"max_date": 365,
"requires_confirmation": false,
"staff_ids": [5, 6],
"staff_base_costs": {
"5": "50.00",
"6": "55.00"
},
"availability": [
{
"id": 45,
"range_type": "time:range",
"from_range": "09:00",
"to_range": "17:00",
"appointable": true
}
]
}
]

Use Cases

  1. Product Listing - Display available appointment products
  2. Staff-Specific Products - Filter products by staff member
  3. Product Configuration - View appointment-specific product settings
  4. Frontend Booking - Get product details for booking form