Glozr docs

WordPress & WooCommerce

WooCommerce deep links

The WooCommerce surface area of the Glozr plugin goes well beyond content sync. It wires up shopper authentication, order lookup, lead mirroring, coupon distribution, abandoned cart re-engagement and product-page enrichment.

WooCommerce load-order guard

Plugins on a typical WordPress install load alphabetically, which means Glozr can boot before WooCommerce. Rather than rely on class_exists('WooCommerce') at early hook priorities (which would silently fail), the plugin defers every WC-dependent operation to the woocommerce_loaded action. By then WooCommerce's main class is fully registered and every feature wires up safely.

Logged-in shopper context

When an authenticated customer hits a page that renders the widget, the plugin attaches a short-lived signed token containing:

  • The WordPress user ID.
  • The SHA-256 hash of the customer's email (never the raw email).
  • The source identifier of the WooCommerce source the agent is bound to.
  • An expiration timestamp roughly 24 hours out.

The token is verified at widget init and the resulting shopper claims are persisted on the conversation. That's what lets the bot resolve “my last order” without asking for email or order number.

Order lookup tool

The lookup_order tool answers questions about order status, shipping, returns and refunds. It:

  1. Reads the shopper claims stored on the conversation.
  2. Resolves the agent's WooCommerce source URL.
  3. POSTs an HMAC-signed request to /wp-json/pitchbar/v1/orders/lookup.
  4. Returns up to 10 of the customer's recent orders, including tracking URLs when present.

The tool refuses to run when: no shopper authentication is on the conversation, no WooCommerce source is configured, or the API token has no signing credentials available.

Lead push-back

Leads captured by the widget are mirrored back to WordPress. If WooCommerce is active, the plugin creates a customer; otherwise a standard subscriber. Existing emails update the user record in place rather than create duplicates, and Glozr's conversation ID + lead ID are stored as user meta for downstream correlation.

Coupon emission & apply

Ecommerce agents emit coupon blocks when visitor intent aligns with an available promotion. The end-to-end flow:

  1. The plugin syncs active WooCommerce coupons into the Glozr source config.
  2. The LLM receives the coupon codes inside its system prompt context.
  3. When relevant, the model emits XML markers for a coupon card.
  4. The widget renders the card with copy & apply buttons.
  5. Tapping Apply stages the code in a 15-minute WordPress transient. The code activates automatically the next time the visitor opens their cart, via the woocommerce_load_cart_from_session hook.

Abandoned cart re-engagement

The plugin mirrors WooCommerce cart state to localStorage — item count plus a last-modified timestamp. Behavior rules configured with kind: "abandoned_cart" can then trigger re-engagement messages once the cart has been idle for a configurable threshold.

The plugin listens for cart mutations and clears state on the order-received page. A five-minute global cooldown prevents abandoned-cart spam if the visitor bounces in and out of their cart.

Product page context

On single-product pages, the plugin enriches the page context payload with WooCommerce specifics: SKU, list price, sale price, sale flag, stock status and the canonical product URL. This biases retrieval toward the product the visitor is actually staring at.

Version support

The plugin supports WooCommerce 3.0+, with active testing on the 8.x and 9.x release lines. High-Performance Order Storage (HPOS) is fully supported via WooCommerce's public APIs.