=== DeelFlows for WooCommerce ===
Contributors: deelflows
Tags: whatsapp, abandoned cart, cart recovery, woocommerce, chat
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Recover abandoned carts on WhatsApp: checkout opt-in checkbox, cart capture, recovery links, and an optional WhatsApp chat widget via DeelFlows.

== Description ==

DeelFlows for WooCommerce connects your store to your [DeelFlows](https://deelflows.com) workspace so you can recover abandoned carts and send order updates over WhatsApp.

* Works with both the classic (`[woocommerce_checkout]`) and block-based WooCommerce checkout.
* Adds a "Send me order updates and offers on WhatsApp" checkbox to checkout. It is unticked by default — no shopper is subscribed to WhatsApp messaging unless they explicitly tick it.
* Sends a snapshot of the cart as the shopper types their contact details, so DeelFlows can trigger a WhatsApp recovery message if they leave without ordering.
* Recovery links from DeelFlows WhatsApp messages rebuild the shopper's cart and take them straight back to checkout.
* Optionally shows your DeelFlows WhatsApp chat widget on the storefront (configured in DeelFlows, toggled per store here).
* All requests to DeelFlows are signed (HMAC-SHA256) and sent fire-and-forget — the plugin never slows down or blocks checkout.

A DeelFlows account is required. The plugin does nothing — and sends nothing — until you paste your DeelFlows plugin token into WooCommerce → DeelFlows.

== External services ==

This plugin connects to the DeelFlows platform (by default `https://app.deelflows.com`, or the URL you configure). It is a bridge to that service and is not functional without a DeelFlows account and plugin token. No data is sent anywhere before a valid plugin token is saved by the store administrator.

What is sent, and when:

* **Checkout cart capture** — when a shopper on the checkout page enters a phone number or email, the plugin sends to your DeelFlows workspace: the contact details entered at checkout (phone, email, first/last name), whether the WhatsApp opt-in checkbox is ticked, a snapshot of the current cart (product ids, names, quantities, total, currency), a random cart-session id, and a recovery URL pointing back to your store. This repeats (debounced) as the shopper edits those fields.
* **Chat widget lookup** — if the chat widget toggle is on, the plugin periodically (cached ~12 hours) asks DeelFlows for your widget's public id, and, when the widget is enabled in DeelFlows, loads the widget script `widget.js` from your DeelFlows URL on storefront pages.

All requests are authenticated with your per-workspace secret and signed with HMAC-SHA256. Data goes only to the DeelFlows workspace identified by your token.

This service is provided by DeelFlows: [terms of service](https://deelflows.com/terms), [privacy policy](https://deelflows.com/privacy).

== Installation ==

1. Install and activate this plugin (Plugins → Add New → Upload Plugin, or `wp plugin install` via WP-CLI), the same way you install any WooCommerce extension.
2. In your DeelFlows account, go to **Settings → Integrations → WooCommerce** and copy the **Store plugin** token (`df_wc_{workspaceId}:{secret}`).
3. In WordPress, go to **WooCommerce → DeelFlows** and paste the token into the **Plugin token** field. Leave **DeelFlows URL** as the default unless DeelFlows support has asked you to point it somewhere else (for example a staging environment). Save.
4. Once the page shows the connected status, cart capture, the WhatsApp opt-in checkbox, and recovery links are all active — no further setup needed.

== Frequently Asked Questions ==

= What data does this plugin send, and when? =

As a shopper reaches checkout and types their phone number, email, or name, the plugin sends that contact info plus the current cart (product names, quantities, and total) to your DeelFlows workspace. It also sends whether the shopper ticked the WhatsApp opt-in checkbox. Nothing is sent before the shopper reaches checkout, nothing is sent before you connect a plugin token, and nothing is sent to WhatsApp itself by this plugin — DeelFlows uses the captured data to decide whether and when to send a cart-recovery message. See the "External services" section for the full list.

= Is this GDPR-compliant / do you need explicit consent? =

The plugin only marks a shopper as subscribed to WhatsApp messaging if they explicitly tick the "Send me order updates and offers on WhatsApp" checkbox at checkout — that checkbox is off by default and is the sole source of WhatsApp opt-in consent. Billing details captured without ticking the box are used only for cart-recovery matching inside your own DeelFlows workspace, not for WhatsApp messaging. You remain the data controller; review DeelFlows' [privacy policy](https://deelflows.com/privacy) and mention the integration in your own store privacy policy.

= Where does the data go? =

Only to the DeelFlows workspace identified by the plugin token you configured — no third parties, no shared infrastructure. Requests are authenticated with a per-workspace secret and signed with HMAC-SHA256 so only your DeelFlows workspace can read them.

= Does this slow down my checkout? =

No. All requests to DeelFlows are sent non-blocking (fire-and-forget) with a short timeout, so a slow or unreachable DeelFlows endpoint never delays checkout for your shoppers.

= Does this work with the new block-based checkout? =

Yes, with one version note: the WhatsApp opt-in checkbox on the block-based checkout relies on WooCommerce's Additional Checkout Fields API, which shipped in **WooCommerce 8.6**. On WooCommerce 8.6+ the checkbox appears on both the classic and block checkout. On older WooCommerce versions (below 8.6), the checkbox appears only on the classic (`[woocommerce_checkout]`) checkout — cart capture itself still works on the block checkout, just without the opt-in checkbox until you upgrade WooCommerce.

= Do I need a DeelFlows account? =

Yes. The plugin is the store-side half of the DeelFlows WooCommerce integration and does nothing without a plugin token from a DeelFlows workspace.

== Screenshots ==

1. DeelFlows Inbox: WhatsApp conversations from your store, with the AI agent handling replies and handing off to your team.
2. AI agent actions: product lookup from your synced catalog, lead capture, and booking links.
3. Journey builder: automate WhatsApp follow-ups such as abandoned-cart recovery and order updates.

== Changelog ==

= 1.0.0 =
* Initial release: cart capture (classic + block checkout), WhatsApp opt-in checkbox, cart-recovery links, and the optional WhatsApp chat widget.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
