Orders
Overview
Shoppers can ask about their orders. Every lookup re-checks ownership. Guests must verify order number + billing email. The chat UI does not show billing addresses or payment card data.
How It Works
- Logged-in:
list_my_orders(max 10) andget_orderfor owned IDs viawc_get_order()/wc_get_orders()(HPOS-safe). - Guest:
verify_guest_orderthen details. - Optional shipment tracking from
_wc_shipment_tracking_itemsmeta (WooCommerce Shipment Tracking-style). Filteraiwsa_order_tracking. - Custom number maps:
aiwsa_resolve_order_number.
How to Enable It
WooCommerce → AI Assistant → Order Assistant → enable the three tools.
Configuration
Frontend Usage
Logged-in: “Where is my order?” Guest: provide #1042 and the checkout email.
Example
Customer ID 12 asks for order 1042; if order.customer_id matches, status + items + total + tracking (if any) are shown.
Behavior
| Situation | What happens |
|---|---|
| Wrong email / not owner | No order data |
| Guest tools off | Guests cannot verify |
| Refunded/cancelled | Status label from WooCommerce (whatever statuses exist on the order) |
| No tracking plugin | Shipping section without tracking numbers |
Supported statuses are whatever WooCommerce stored on that order. The plugin does not invent a private status list.
Security restrictions
- Ownership rechecked every call.
- No billing PII in the UI payload.
- Rate limits apply.
Limitations
- Not a full account dashboard (no invoice PDF, no pay-again).
- Guest proof is order number + email, not a password.
Troubleshooting
“I can’t see my order”: log in, or verify email matches billing email exactly. Sequential vs custom order numbers: may need aiwsa_resolve_order_number.