=== Octopush SMS Automation & Cart Recovery ===
Contributors: octopush, hamzachaudhry
Tags: woocommerce, sms, octopush, abandoned cart, marketing
Requires at least: 5.8
Tested up to: 7.0
Stable tag: 1.1.13
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Recover more sales with Octopush for WooCommerce: automated SMS, abandoned-cart recovery, campaigns, contact sync, and optional live chat.

== Description ==

**This is the official WordPress plugin of Octopush (https://octopush.com/).** It is developed and owned by Octopush and connects your WooCommerce store to the Octopush SMS service. It provides SMS automation, contact management, campaigns, abandoned cart recovery with popup and inline capture, and an optional live chat widget.

**Requirements**

* WordPress 5.8 or higher
* PHP 7.4 or higher
* WooCommerce (for SMS automation, abandoned carts, and contact features)
* An Octopush account and API credentials (api key, sender, etc.)

**Features**

* **SMS automation** – Send SMS to customers (new order, order status) and to the shop owner
* **Abandoned cart** – Detect abandoned carts, capture guest contact (popup and/or inline on cart page), send timed reminders (15m, 2h, 24h, 72h) with recovery links
* **Contacts** – WooCommerce contacts list, sync with Octopush
* **Campaigns** – Send one-off SMS campaigns to WooCommerce contacts
* **Reports & logs** – View sent SMS and errors by context
* **Live chat** – Optional Octopush chat widget on the front end
* **Customization** – Customize abandoned cart popup and inline field (colors, text, timing)

**Privacy & data**

The plugin sends data to Octopush (phone numbers, names, messages) when you send SMS or sync contacts. Abandoned cart capture is optional and configurable. Document your use of Octopush and this plugin in your privacy policy. Do not track users without consent; configuring and using the plugin implies consent for the Octopush service.

== External services ==

WordPress requires that plugins which connect to external services disclose this clearly. This plugin connects to services operated by Octopush (https://octopush.com/). Use of these services is required to send SMS, manage contacts, and display the optional live chat widget.

**What the services are and what they are used for:**
* **Octopush API (https://api.octopush.com)** – Used to send SMS messages, create and manage contact lists, sync contacts, and check account balance.
* **Octopush Live Chat (https://livechat.octopush.com)** – Used to load the chat widget on your site when enabled.
* **Octopush central cron (https://octopush.com/wordpress-cron/)** – Optional Octopush-operated service used when you turn on “automatic cron” for abandoned cart checks (or when the plugin attempts best-effort registration on activation, if this feature is available in your build). It registers your store’s **external cron URL** with Octopush so their infrastructure can call that URL on a schedule (for example every 5 minutes), triggering abandoned-cart processing on your site without you configuring a separate cron provider.

**What data is sent and when:**
* **Octopush API:** When you send SMS, run campaigns, sync contacts, or check connection/balance from Settings, the plugin sends to Octopush: your API credentials (email and API key), recipient phone numbers, message content, and contact data (name, phone, optional email). Data is sent only when you perform those actions.
* **Octopush Live Chat:** When the widget is enabled, the plugin loads the chat SDK and sends your configured website token. Chat conversations are handled by Octopush; the plugin does not send additional personal data beyond what the chat widget collects.
* **Octopush central cron:** When registration runs (on activation as a best-effort attempt if central cron is configured in the plugin, or when a shop manager enables automatic cron in the admin), the plugin sends an HTTPS POST with JSON to Octopush endpoints under https://octopush.com/wordpress-cron/ (for example register.php). The body includes: your site’s **full external cron URL** (which contains your site’s secret cron key in the query string), your site’s public **home URL** (HTTPS), and a **shared server secret** (distributed with the plugin build) used only to authenticate the request to Octopush—not your Octopush account password or API key. When you disable automatic cron, the plugin POSTs JSON to the unregister endpoint with the same cron URL, the **job identifier** returned at registration, and the same shared server secret. No customer personal data is sent to this service; it only coordinates HTTP requests to your own WordPress cron URL. If central cron is not configured for your build, these requests are not made and you can still use the manual external cron URL or “Run abandoned cart check now” as documented in the FAQ.

Octopush’s terms of service and privacy policy apply to data processed by these services. **Terms of service and privacy policy:** Use of these services is subject to Octopush terms and privacy policy. Direct links: Terms of service (CGU) https://octopush.com/conditions-generales-d-utilisation/ ; Privacy policy https://www.octopush.com/politique-de-confidentialite/ . If these URLs change, find the current links in the footer of https://www.octopush.com/ .

== Installation ==

1. Install and activate WooCommerce if you plan to use SMS automation or abandoned carts.
2. Upload the plugin files to `/wp-content/plugins/octopush-sms-automation-cart-recovery/` or install through the WordPress Plugins screen.
3. Activate the plugin through the Plugins screen.
4. Go to Octopush SMS Automation & Cart Recovery in the admin menu and open Settings. Enter your Octopush API key, sender, and other credentials. Save and test the connection.
5. Configure SMS templates (Abandoned Carts, SMS Toward Customers, SMS Toward Shop Owner) and optional popup/inline customization under Octopush SMS Automation & Cart Recovery -> SMS Automation.

== Frequently Asked Questions ==

= Do I need an Octopush account? =

Yes. You need an Octopush account and API credentials to send SMS. The plugin acts as an interface to the Octopush service.

= Is abandoned cart capture optional? =

Yes. You can enable or disable the time-based popup and the inline name/phone field on the cart page independently. Both are configurable under SMS Automation → Abandoned Carts → Popup & Inline Capture Customization.

= How do abandoned cart alerts run? Do I need to set up cron? =

Abandoned cart detection and SMS alerts run only when the **external cron URL** is called. There is no WordPress cron or traffic-based trigger. You must call the secret URL (shown in SMS Automation → Abandoned Carts under "External cron (required for automatic alerts)") every 5 minutes from your server’s crontab, your host’s cron tool, or a free service like cron-job.org. The URL is unique to your site and must be kept secret. Until this is set up, use the "Run abandoned cart check now" button for manual runs.

= Where are contacts stored? =

Contacts are stored in your WordPress database (custom table for Woo contacts). The plugin can sync WooCommerce-related contacts to Octopush when you link a list and run sync.

= How does it scale for large stores? =

For most stores you can use the defaults, but there are filters to safely tune performance, with **enterprise-friendly defaults already applied**:

* **Woo contacts loaded at once** – filter `octopush_pro_get_woo_contacts_limit` (default `100000`). Increase or decrease depending on your memory budget.
* **Backfill from existing orders** – filter `octopush_pro_backfill_woo_orders_limit` (default `100000`). Controls how many historic orders are scanned on first backfill.
* **Sync chunk size** – filter `octopush_pro_sync_chunk_size` (default `100`). Controls how many contacts are sent to Octopush per API call.
* **Abandoned cart contacts per page (admin)** – filter `octopush_pro_admin_abandoned_contacts_per_page` (default `1000`). Controls how many contacts are shown per page in the dashboard.
* **Reports rows per page** – filter `octopush_pro_reports_per_page` (default `100`). Controls how many log entries are shown per page.
* **Abandoned capture cooldown** – filter `octopush_pro_abandoned_capture_cooldown` (default `5` seconds between captures per session). You can tune this for stricter anti‑spam.
* **Log & cart retention** – filters `octopush_pro_log_retention_days` (default `365`) and `octopush_pro_cart_retention_days` (default `730`). Raise, lower, or disable (set to `0`) depending on your compliance and storage needs.

Recommended starting points:

* **Small stores (≤10k customers)** – keep defaults or modestly increase limits.
* **Medium stores (~10k–100k customers)** – Woo contacts/backfill limits around `50_000`, sync chunk size `50–100`, reports `50–100` rows per page.
* **Large/enterprise (100k+ customers)** – Woo contacts/backfill limits `100_000+` (or use batched exports), sync chunk size `100–250`, and longer retention (365+ days) combined with external log archiving.

== Changelog ==

= 1.1.13 =
* Mark compatibility with WordPress 7.0 (`Tested up to: 7.0`).

= 1.1.12 =
* Fix checkout fatal on PHP 8+ by aligning `woocommerce_checkout_order_created` callback arguments with WooCommerce hook signature.
* Add Store API checkout compatibility bridge via `woocommerce_store_api_checkout_order_processed` for Checkout Block flows.

= 1.1.11 =
* Update plugin author metadata to Muhammad Hamza with WordPress.org profile URL.

= 1.1.10 =
* Ensures readme Stable tag and plugin version match the published release on WordPress.org.

= 1.1.7 =
* Credit developer Muhammad Hamza in plugin metadata; add WordPress.org contributor profile.

= 1.1.6 =
* Improve plugin short description text to be clearer and more conversion-focused in the plugin listing.

= 1.1.5 =
* Readme: update Octopush terms of service (CGU) link to https://octopush.com/conditions-generales-d-utilisation/ .

= 1.1.4 =
* Rename main plugin file to `octopush-sms-automation-cart-recovery.php` (matches WordPress.org plugin slug).
* Document Octopush central cron (`https://octopush.com/wordpress-cron/`) under External services in this readme (registration/unregistration, data sent, when).

= 1.1.3 =
* Rebrand plugin name, slug, and text domain to `octopush-sms-automation-cart-recovery` (no functional logic changes).

= 1.1.2 =
* Abandoned cart SMS to French (+33) numbers: append mandatory Octopush STOP clause `[STOP Au 30101]` and align API purpose with campaigns (fixes HTTP 400 when STOP was missing).

= 1.1.1 =
* Maintenance release; version bump to 1.1.1.

= 1.1.0 =
* Remove macOS `.DS_Store` from the plugin tree; packaging notes in `PACKAGING.txt` (WordPress plugin ZIP must not contain dotfiles such as `.gitignore` — Plugin Check `hidden_files`).
* Version bump to 1.1.0.

= 1.0.10 =
* Internal cleanup for release packaging (remove hidden files such as .DS_Store).

= 1.0.9 =
* Country dropdown arrow size increased by 40% in abandoned cart (popup and inline) and in Settings Store Owner Phone field.

= 1.0.8 =
* Store Owner Phone dropdown in Settings now shows the country flag next to each option in the list.

= 1.0.7 =
* Store Owner Phone in Settings now uses the same searchable country dropdown as the abandoned cart popup and inline field (country name + code, searchable, flag + code when selected).
* Abandoned cart phone field: dropdown visibility fix, larger arrow, country code visibility and padding improvements.

= 1.0.6 =
* Settings page: plugin version is now shown above "Connection Status & Balance".
* Abandoned cart phone field: UI polish (focus states, symmetric padding, country dropdown styling).

= 1.0.5 =
* Abandoned cart popup and inline: country code dropdown now shows country name and code (e.g. "France (+33)") and is searchable by country name or dial code.

= 1.0.4 =
* Show plugin version on the Settings page so merchants can confirm which version they are running.

= 1.0.3 =
* Automatically enable central cron on activation when available.
* Improve cleanup of non-abandoned carts after normal checkout so the Abandoned Carts report stays accurate.

= 1.0.2 =
* Internal improvements and cron reliability fixes.

= 1.0.1 =
* Initial release.
* SMS automation (customers, owner, abandoned carts), campaigns, contacts sync, abandoned cart popup and inline capture, reports, live chat widget.

== Upgrade Notice ==

= 1.1.13 =
Readme: declare support for WordPress 7.0.

= 1.1.12 =
Fixes a PHP 8+ checkout fatal caused by hook argument mismatch and adds Store API checkout compatibility handling.

= 1.1.11 =
Author metadata update in plugin header.

= 1.1.10 =
Version/readme alignment with the tagged release on WordPress.org.

= 1.1.7 =
Developer credit and WordPress.org contributor listing update.

= 1.1.6 =
Listing text refresh: improved plugin short description for better storefront visibility.

= 1.1.5 =
Readme: corrected Octopush terms of service URL in External services.

= 1.1.4 =
WordPress.org review: main filename aligned with slug; readme documents Octopush central cron external service.

= 1.1.3 =
Rebrand release: new plugin name, slug, and text domain.

= 1.1.2 =
Abandoned cart SMS for France: mandatory STOP clause appended for +33 numbers.

= 1.1.1 =
Maintenance release.

= 1.1.0 =
Packaging cleanup: no `.DS_Store` or other dotfiles in the plugin ZIP; see `PACKAGING.txt` before uploading to WordPress.org or Plugin Check.

= 1.0.10 =
Internal cleanup for release packaging (remove hidden files such as .DS_Store).

= 1.0.9 =
Larger country dropdown arrow in abandoned cart and Store Owner Phone field.

= 1.0.8 =
Store Owner Phone dropdown in Settings now shows country flags in the list.

= 1.0.7 =
Store Owner Phone in Settings now has the same searchable country dropdown. Abandoned cart phone field improvements.

= 1.0.6 =
Settings: version moved above Connection Status & Balance. Phone field UI improvements.

= 1.0.5 =
Country dropdown in abandoned cart popup and inline field now shows country names and is searchable by name or code.

= 1.0.4 =
Plugin version is now shown on the Settings page for easier support and updates.

= 1.0.3 =
Automatically enable central cron on activation when available, and improve cleanup of non-abandoned carts after checkout.

= 1.0.2 =
Internal improvements and cron reliability fixes.

= 1.0.1 =
Initial release. Requires WordPress 5.8+, PHP 7.4+, and WooCommerce for full functionality.
