---
version: v1.3.0
title: WordPress & WooCommerce companion plugin v2.0.0
released_at: 2026-05-12
---

## New: official WordPress & WooCommerce plugin

A first-party WordPress + WooCommerce plugin now ships with every
Pitchbar deployment. Drop it on any WordPress 6.4+ install running
PHP 7.4 or newer, paste a workspace API token, and the streaming
chat widget loads on every public page — with content sync, product
cards, coupon application, order lookup, and lead mirroring out of
the box.

**Widget embed.** One asynchronous `<script>` tag injected into
`wp_footer`, scoped to the post types you opt into. Hidden on
`wp-admin`, login, AJAX, REST, XML-RPC, and cron paths. Emits
`data-page-dir` and `data-page-locale` attributes so the bar
mirrors correctly on Arabic, Hebrew, Persian, and Urdu locales.

**Content sync.** Bulk + delta ingest of posts, pages, custom post
types, and WooCommerce products as Pitchbar knowledge sources. SHA-
256 content hash short-circuits re-indexing on unchanged content,
so re-running "Sync now" against a stable site is effectively free.

**Page-builder rendering.** Elementor, Beaver Builder, Oxygen, and
Bricks pages are rendered with the builder's own native API before
sync, so the synced HTML reflects what visitors actually see. Divi
posts route through `the_content` with `setup_postdata` primed so
third-party filter callbacks see a valid `$post` global. A
`pitchbar_post_content_html` filter lets sites post-process the
final HTML (strip nav chrome, force a custom template, redact a
section) without forking the plugin.

**Resumable sync.** Each sync pass enforces a 20-second wall-clock
budget. When a large site can't finish in one tick, the plugin
persists a resume marker as a WordPress transient and schedules a
WP-Cron continuation 30 seconds out. Shared hosting with a 30s
`max_execution_time` cap no longer fatals mid-sync. The Plugins
admin shows a soft notice while a chunked sync is in flight.

**WooCommerce shopper context.** When a logged-in WC customer
visits a page, the plugin attaches a signed `data-shopper-token`
to the widget script tag. The widget forwards it to `/widget/init`;
Pitchbar verifies it and bakes `wp_user_id` + `email_hash` (never
plaintext) claims into the chat session.

**Order lookup tool.** EcommercePreset's `order_status` capability
maps to a real tool. When the visitor asks about orders, the LLM
calls `lookup_order(limit, order_number?)`, which POSTs to
`/wp-json/pitchbar/v1/orders/lookup` over HMAC-signed callback.
Returns id, number, status, total, currency, items, tracking URL
(AfterShip / ST tracking / generic meta), and the customer's order
view URL.

**Coupon emission & apply.** The plugin's `CouponSyncer` snapshots
publish-status `shop_coupon` entries after every product sync (max
50), filters expired / over-limit, and posts them to Pitchbar. The
LLM emits `<coupon code="WELCOME10" .../>` markers in chat replies;
the widget renders them as cards with Copy and Apply buttons. Apply
stages the code in a 15-minute transient that auto-applies on the
visitor's next cart load via the `woocommerce_load_cart_from_session`
hook.

**Abandoned cart re-engagement.** A new `BehaviorRule.kind =
"abandoned_cart"` lets you re-engage a visitor whose cart has been
idle. The plugin's `cart-state.js` mirrors every WooCommerce
`added_to_cart` / `removed_from_cart` event into `localStorage`; the
widget polls every 30 seconds and fires when the cart sits past
the rule's `idle_minutes` threshold.

**Lead push-back.** Every Pitchbar lead is mirrored to WordPress as
a WC customer (when Woo is active) or WP subscriber, with
`pitchbar_lead_id` + `pitchbar_conversation_id` in user meta so the
store owner can correlate. Idempotent on email — re-pushes update,
never duplicate.

**Workspace API tokens.** New `/settings/api-tokens` admin page
issues workspace-scoped bearer tokens with granular abilities (the
plugin uses `wp:integration`). Pitchbar stores only the SHA-256
hash of the plaintext; revoke instantly invalidates without
deleting audit history. Cross-workspace revoke is forbidden.

**HMAC signed callbacks.** Pitchbar → plugin calls (order lookup,
coupon apply, lead push) are signed with HMAC-SHA256 over the raw
body using a per-token `shopper_signing_secret`. 5-minute replay
window. The plugin verifies via constant-time `hash_equals`.

**Super-admin plugin distribution.** New
`/admin/integrations/wordpress` page lets super-admins build and
download the install-ready zip directly from the Pitchbar admin.
Backed by the new `php artisan pitchbar:build-wp-plugin` Artisan
command.

## Improvements

**Plugin-load-order race fixed.** v1.x of the plugin trusted
`class_exists('WooCommerce')` at `plugins_loaded` priority 10,
which silently disabled WooCommerce features when alphabetical
plugin order put `pitchbar` before `woocommerce`. v2.0.0 defers
every WC-dependent registration to the `woocommerce_loaded` action
(with a `did_action` fallback for the priority-20+ case), so the
race is eliminated.

**Coupon enumeration via `shop_coupon` CPT.** Replaces the v1.x
reliance on `wc_get_coupons()` (not public WC API on every
release) with `get_posts(['post_type' => 'shop_coupon'])` +
`new WC_Coupon($id)`. Works on every WC version since 2.0.

**`abandoned_cart` admin trigger.** Backend already supported it;
the agent Behavior triggers admin page now exposes it in the kind
dropdown.

**Comprehensive WordPress docs.** Seven new documentation pages
under the "WordPress & WooCommerce" group: Overview, Install &
connect, Content sync, Page builders, WooCommerce deep links,
REST API reference, Troubleshooting.

## Fixes

**Page-builder content reaches the RAG store.** Pre-v2.0 the
plugin called `apply_filters('the_content', $post->post_content)`
without priming `setup_postdata`, which made plenty of
`the_content` callbacks early-return on `is_null($post)`. The
Elementor / Bricks / Oxygen path was worse — those builders don't
store layout in `post_content` at all, so the synced HTML was
empty. The fix detects each builder via postmeta and calls its
native renderer.

**Sync survives shared hosting timeouts.** The 30-second PHP
execution cap on shared hosts no longer fatals mid-sync on large
catalogs. The resumable sync pattern (transient + WP-Cron
continuation) lets a 5,000-post sync finish over multiple ticks.

**Conversation cookie lifecycle.** The widget writes
`pitchbar_conv_id` on init success so the plugin's
`CartCouponController::applyPendingCoupon` hook can locate the
correct staged coupon. Pre-v2.0 the cookie was only set when
`?pitchbar_conv` arrived as a query parameter, which left
chat→cart flows without a correlation key.
