Cart
Overview
The assistant uses the WooCommerce cart session, not a parallel basket. Shoppers can view totals, add products, change quantity, remove lines, and jump to checkout.
How It Works
GET /aiwsa/v1/cart— current cart +cart_url+checkout_urlfromwc_get_checkout_url()/ cart URL.- Add from AI: tool
add_to_cart→ Confirmation_Broker → shopper Confirm →POST .../confirm. Request cannot change product or qty. - Add from widget
POST /cart/add: also staged through the same broker. POST /cart/updateand/cart/removewrite the session directly (when tools enabled).- Extra JSON fields are ignored. Client cannot set price. Quantity capped (
aiwsa_max_add_to_cart_quantity).
How to Enable It
WooCommerce → AI Assistant → Cart Assistant → enable tools. Appearance shows the cart icon in the widget.
Configuration
Frontend Usage
- Add from a product card or accept an AI proposal (Confirm).
- Open the cart control.
- Change qty / remove.
- Click Checkout (primary button) to leave chat for WooCommerce checkout.
Example
Shopper confirms adding product 412 qty 1. Mini-cart shows line, subtotal from WooCommerce, checkout button.
Behavior
| Situation | What happens |
|---|---|
| Out of stock / not purchasable | Add fails with cart error |
| Variable without variation | Must select variation |
| Confirm expired | Must add again |
| Tool disabled | Corresponding UI/API hidden or refused |
| Guest | Session cart like the rest of WooCommerce |
Limitations
- Not a custom checkout. Payment happens on WooCommerce.
- Clear cart is a staged, confirmed action.
Troubleshooting
Add does nothing: Enable AI Agent, add_to_cart tool, product purchasable, nonce from /config. Quantity buttons missing: update_quantity off.