Pitchbar Plugin for WordPress & WooCommerce
Pitchbar for WordPress & WooCommerce Overview & Sales-AI Integration Engine
Pitchbar for WordPress & WooCommerce is a PHP 8.x plugin engineered for store operators and agencies to embed a streaming Sales-AI chat widget that answers from a site’s own content. The module resolves a structural gap in the chat-plugin category: generic widgets ship a third-party script while page-builder pages store their layouts in postmeta, leaving post_content empty and the AI blind to what visitors actually read. In production workflows it operates as the WordPress-side bridge that syncs knowledge in the background, resolves real orders, and stages coupon actions against the live WooCommerce cart.
Technical Specifications & Deployment Matrix
| Engineering Metric | Deployment Specification |
|---|---|
| Base Technology / Framework | WordPress plugin written in PHP, with JavaScript, HTML, and CSS assets included |
| Runtime Requirements | PHP 8.x; an active Pitchbar workspace with URL and API token pasted into Settings → Pitchbar |
| Communication Protocols | Bearer-token REST calls to the workspace; HMAC-SHA256 signed callbacks on /wp-json/pitchbar/v1/orders/lookup and /cart/coupon with a 5-minute replay window |
| Page Builder Dependencies | Render support for Elementor (Free + Pro), Divi, Beaver Builder, Oxygen, and Bricks |
| Browser Compatibility | IE11, Firefox, Safari, Opera, Chrome, Edge |
| Persistence Footprint | wp_options entries, 15-minute coupon transients, user meta for lead and conversation IDs, WP-Cron resume markers during chunked syncs |
Knowledge Sync & Commerce Execution Pipeline
Content travels in resumable batches from WordPress to the Pitchbar agent, while signed REST callbacks execute store actions in the reverse direction. On the front end, the loader injects into wp_footer with a script async attribute, scoped to opted-in post types, and passes a JSON page-context blob — post ID, post type, permalink, taxonomies, and visible product fields when WooCommerce is active — so retrieval prefers the page the visitor is browsing. The widget itself renders inside a Shadow DOM, which prevents theme CSS from styling it and vice versa. For teams writing custom post-processing logic beyond the provided filter surface, CodeGenie serves as an independent AI-powered code generation path for drafting those hook implementations.
Architectural & Functional Highlights
- Page-builder native rendering: The plugin invokes each builder’s own renderer — Elementor’s get_builder_content_for_display, Divi’s the_content filter pass, FLBuilder::render_content_by_id, Oxygen’s ct_template_output, and Bricks’ Frontend::render_content — so visible HTML reaches the agent intact. First-match-wins detection based on builder postmeta keys prevents double rendering on sites that switched builders mid-project.
- Resumable delta indexing: Posts, pages, opted-in custom post types, and the full WooCommerce catalog sync in batches of 50 with content-hash dedupe. Each pass runs under a hard 20-second wall-clock budget, persists a transient resume marker, and schedules a WP-Cron continuation 30 seconds out, so large catalogs survive shared hosting’s 30-second execution cap. Delta hooks on save_post and the WooCommerce product lifecycle keep the agent current between full syncs.
- Deep store actions: Signed order lookup returns status, items, totals, tracking URLs, and a deep-link to the customer’s view-order page. Coupons validate through WC_Coupon and stage in a 15-minute transient before apply_coupon fires on the next cart load. Captured leads mirror back through wc_create_new_customer, idempotent on email, so repeat form fills never duplicate accounts.
- Admin status surface: A Pitchbar column on the Posts, Pages, and Products list tables shows Indexed, Out of date, or Not indexed pills derived from the per-row sync timestamp plus content hash, with a fixed 110px column width to prevent header wrapping on crowded screens.
- Two-direction security envelope: Outgoing requests carry a Bearer token hashed with SHA-256 at rest; incoming callbacks verify HMAC-SHA256 signatures over a per-token shared secret. Shopper context lifts only wp_user_id and a SHA-256 email hash into the JWT — never plaintext PII.
Production Deployment & Implementation Considerations
Deployment requires two prerequisites: a WordPress installation on PHP 8.x and a Pitchbar workspace whose URL and API token are entered under Settings → Pitchbar, where a Test Connection routine validates the pair, lists available agents, and reports HTTP status codes, the attempted URL, transport error codes, and the first 800 characters of the upstream response body when a request fails. All settings, connection tests, and sync triggers sit behind the manage_options capability, and every AJAX endpoint verifies a WordPress nonce. On the server side, the mandatory workspace runs on a different runtime entirely; Pitchbar operates as a standalone self-hosted Laravel SaaS with RAG retrieval, lead capture, and Stripe billing, decoupled from the WordPress codebase and reachable by any deployment method the host permits.
Implementation boundaries are explicit. The widget only loads on front-end requests for opted-in post types — admin screens, wp-login.php, AJAX, REST, XML-RPC, and cron requests are excluded automatically. Syncs are bounded by the 20-second time budget described above, which governs throughput on constrained hosts. Customization operates through the pitchbar_post_content_html filter, which lets themes or site-specific modules post-process rendered builder HTML (stripping navigation, forcing a template) without forking the plugin, plus post-type opt-in toggles on the settings screen.
Frequently Asked Questions
Does the plugin function without an active Pitchbar workspace?
No. Every widget embed, knowledge sync, and store callback depends on a workspace URL and API token entered in the settings page, a pairing the Test Connection diagnostic validates by listing the agents available in that workspace.
Are subscription, bundle, and custom product types included in catalog sync?
Yes. Product sync applies no type filter, so subscriptions, bookings, memberships, and custom extension types are indexed, and a WP_Query fallback recovers catalogs that wc_get_products reports as empty on multilingual or membership stores.
Does the widget appear on admin, login, or REST endpoints?
No. The loader injects only into wp_footer on public front-end requests for opted-in post types; admin screens, wp-login.php, AJAX, REST, XML-RPC, and cron requests are skipped automatically so the widget never renders where it should not.
Does uninstalling the plugin leave residual data in the database?
No. The bundled uninstall routine deletes every option the plugin wrote, including connection settings and stored signing secrets, so a reinstall or workspace reconnection starts from a clean state without orphaned rows.