Skip to main content

WooCommerce Orders Extension

This plugin extends the core WooCommerce Orders REST API endpoint to include appointment information.

Endpoint

GET /wp-json/wc/v3/orders/{id}

Base Endpoint: Core WooCommerce Orders endpoint

Extension: This plugin registers an appointments field on order responses.

Purpose: Surface appointment information linked to an order without requiring extra API calls.

Response Field

appointments (array of objects)

Each entry mirrors the Appointments response payload with the following fields:

  • id (int)
  • start (int, epoch seconds)
  • end (int, epoch seconds)
  • start_utc (int, epoch seconds)
  • end_utc (int, epoch seconds)
  • status (string)
  • qty (int)
  • product_id (int)
  • staff_ids (array<int>)
  • all_day (bool)
  • timezone (string)
  • local_timezone (string)
  • order_id (int) - Linkage field
  • order_item_id (int) - Linkage field
  • Additional appointment metadata

Notes:

  • Appointment UTC fields are derived using the same logic as the Appointments controller
  • DST-aware site timezone conversion (IANA TZ preferred, offsets used when no timezone string is set)
  • Empty array when the order has no linked appointments

Example Request

GET /wp-json/wc/v3/orders/98765

Example Response

{
"id": 98765,
"status": "processing",
"line_items": [
{
"id": 55555,
"name": "Haircut",
"product_id": 4321,
"quantity": 1,
"total": "50.00"
}
],
"appointments": [
{
"id": 123456,
"product_id": 4321,
"start": 1766671200,
"end": 1766674800,
"start_utc": 1766671200,
"end_utc": 1766674800,
"status": "confirmed",
"qty": 1,
"staff_ids": [12],
"all_day": false,
"timezone": "Europe/Berlin",
"order_id": 98765,
"order_item_id": 55555
}
]
}

Use Cases

  1. Order Details Page - Display appointment information alongside order details
  2. Email Notifications - Include appointment details in order confirmation emails
  3. Admin Views - Show appointments when viewing orders
  4. Customer My Account - Display appointments with order history