=== Loop Voice for WooCommerce ===
Contributors: loopvoice
Tags: woocommerce, abandoned cart, sms, voice, recovery, webhooks
Requires at least: 6.2
Tested up to: 6.8
Requires PHP: 7.4
WC tested up to: 10.4.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect WooCommerce to Loop Voice for abandoned-cart recovery and order/catalog sync via signed webhooks.

== Description ==

Loop Voice for WooCommerce is a thin bridge between your WooCommerce store and your [Loop Voice](https://loopvoice.com/) workspace.

**What it does**

* Merchant-initiated connection: paste a one-time Loop connect token — no OAuth app store detour.
* Captures cart activity with a stable `cart_key` (UUIDv4), not rotating WooCommerce session tokens.
* Sends abandoned-cart, order, product, customer, and coupon events to Loop over HTTPS.
* Signs every webhook with HMAC-SHA256 (`X-LoopVoice-Signature`).
* Durable outbound queue with WP-Cron retries for transport failures (5xx / network only).
* Optional post-connect catalog backfill (products, customers, coupons).
* Optional WooCommerce REST API keys so Loop can reconcile and repair data.

**What it does not do**

* Does not decide who to call, DNC logic, or flow timing (Loop owns that).
* Does not include advertising trackers or hidden analytics phone-home.
* Does not call Shopify or mint Loop synthetic commerce IDs.

== Installation ==

1. Install and activate WooCommerce.
2. In WordPress, go to Plugins → Add Plugin → Upload Plugin, choose `loop-voice.zip`, and click **Install Now**. (Or upload the `loop-voice` folder to `/wp-content/plugins/`.)
3. Activate **Loop Voice for WooCommerce**.
4. In Loop → Settings → Integrations → WooCommerce, click **Generate connect token** and copy the token (`loopwc_…`).
5. In WordPress → WooCommerce → Loop Voice, paste the token and click **Connect**. The plugin creates a WooCommerce REST API key (read/write) for Loop automatically.

== Frequently Asked Questions ==

= Where does my store data go? =

Event payloads (carts, orders, products, customers, coupons) are POSTed to your configured Loop API base URL over HTTPS, signed with your workspace webhook secret. See the Privacy section.

= Can I change the API base URL? =

Yes. Use the API base URL field for staging/local environments. Production should use the Loop-provided host.

= What if I rotate the webhook secret in Loop? =

Paste the new secret into the plugin settings. You do not need a new connect token unless you disconnect.

= Does uninstall remove data? =

Yes. Deleting the plugin removes options, the outbound queue, cart snapshot transients, and scheduled cron events. Order meta `_loop_voice_cart_key` on historical orders is left intact for audit.

== Privacy ==

This plugin processes store commerce data solely to deliver it to the merchant’s Loop Voice workspace.

**Data sent to Loop (only when connected):**

* Abandoned cart snapshots: cart_key, email/phone when available, line items, totals, billing/shipping.
* Orders: id, status, totals, line items, customer id, cart_key when converting a cart.
* Products (including expanded variations), customers, and coupons — including optional batch backfill after connect.

**Data stored in WordPress:**

* Encrypted webhook secret and optional WooCommerce REST credentials.
* Site origin URL, connection status, abandon idle setting.
* Durable outbound queue and temporary cart snapshots (transients / user meta / HttpOnly cookie for `cart_key`).

**Not collected:** browser fingerprinting, advertising IDs, or third-party marketing pixels. The plugin does not phone home except to the merchant-configured Loop API endpoints for register and webhooks.

== Screenshots ==

1. Connection settings — paste Loop connect token and optional REST keys.
2. Status panel — connection state, last webhook success/error, queue depth.

== Changelog ==

= 1.0.0 =
* Initial release.
* Merchant-initiated connection with a one-time Loop connect token; optional WooCommerce REST keys are created and handed to Loop automatically.
* Signed webhooks (HMAC-SHA256) for cart, order, product, customer, and coupon events.
* Stable `cart_key` (UUIDv4) that survives WooCommerce session rotation and carries through to the converted order.
* Abandoned-cart scanner with a configurable idle window.
* Durable outbound queue: per-job merge on write, order and cart events prioritised over catalog traffic, incremental progress saves, and retries limited to transport failures.
* Catalog backfill for products, customers, and coupons, run through Action Scheduler with a WP-Cron fallback and a watchdog for lost ticks.
* React admin panel for connection state, queue depth, backfill progress, and manual queue/backfill runs.

== Upgrade Notice ==

= 1.0.0 =
Initial public release.
