=== RogalMail for WooCommerce ===
Contributors: rogalmarketing
Tags: email marketing, woocommerce, abandoned cart, newsletter, rogalmail
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.8.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connects your WooCommerce store to RogalMail: customer sync, abandoned cart automations, product sync, and embeddable signup forms.

== Description ==

RogalMail for WooCommerce wires your store into your RogalMail account (rogalmail.com):

* **Customer sync.** A clear, unticked opt-in at checkout and on registration. Customers who tick it are added to RogalMail (and to your default list, if you set one) with their name and email.
* **Abandoned cart.** When a shopper reaches checkout and leaves without buying, the cart — items, prices, total, and a checkout link — is reported to RogalMail, where your abandoned cart automation takes over. When the order completes, a purchase event closes the cart flow, so nobody gets a recovery email for a cart they already paid for.
* **Product sync.** Your catalog stays matched to RogalMail's product library, so the email editor's product block always shows current names, prices, and images.
* **Store email takeover.** In RogalMail, choose for each transactional email type whether WooCommerce sends it or RogalMail sends it with your editable design and the order's details. If RogalMail cannot send one of its emails, WooCommerce sends it as usual.
* **Signup forms anywhere.** Drop `[rogalmail_form id="123"]` into any page, post, or widget to embed one of your RogalMail hosted signup forms.
* **Discount codes (opt-in).** Turn on Discount codes in the settings and your store's coupons sync into RogalMail, so the email editor offers the real code; codes you create in RogalMail are then created in your store, with the outcome reported back. Off by default — an API key alone never changes coupons in your store.
* **Sitewide form embed.** One setting loads a chosen form's loader on every storefront page, no theme edits needed.

Setup lives under WooCommerce → Settings → RogalMail. You need two keys from your RogalMail account: an API key (Integrations) and the event key (shown on the store connection card of any automation). The settings page has a Test connection button and shows a short log of recent activity.

== Installation ==

1. Upload the plugin folder (or the zip, via Plugins → Add New → Upload) and activate it.
2. Go to WooCommerce → Settings → RogalMail.
3. Paste your API key and event key, choose what to sync, and Save.
4. Click Test connection. Then click Sync products now for a first catalog sync.

== Frequently Asked Questions ==

= Does this slow down my checkout? =
No. Sync calls happen after orders and accounts are created, with a short timeout, and every failure is written to the plugin log on the settings page instead of touching the shopper's request.

= When is a cart reported? =
Once per cart state. If the shopper changes what is in the cart, the updated cart is reported; an unchanged cart never fires twice. A completed purchase always closes the open cart flow on the RogalMail side.

= Where does the signup form shortcode get its design? =
The form is hosted by RogalMail and designed in the RogalMail form builder; the shortcode embeds it exactly as the portal's Share snippet does.

== Changelog ==

= 1.8.0 =
* Store email takeover: for each transactional email your store sends (order confirmation, order completed, order on hold, order invoice, refunds, order cancelled), you can choose in RogalMail under Store emails whether WooCommerce sends it or RogalMail does, with a design you edit in RogalMail. Nothing changes until you flip a type. If RogalMail ever cannot send one of its emails, WooCommerce sends it as usual, so a receipt is never lost, and the fallback is noted on the order and in the plugin log. The RogalMail settings page in WooCommerce shows who currently sends each email.

= 1.7.1 =
* Abandoned cart reports now carry the store's persistent cart identity, and the "already reported" marker for a signed-in shopper is remembered on their account instead of only in the browser session — so an unchanged cart is never reported again as if it were new after a session expires. Together with the platform's one-enrolment-per-cart rule, the same cart can no longer start a second reminder sequence.

= 1.7.0 =
* Discount codes, both directions — behind a new "Discount codes" toggle that stays off until you turn it on: your store's coupons sync into RogalMail so you pick the real code in the email editor, and codes you create in RogalMail are created in your store, with the outcome reported back to the code itself. Sweeps run in chunks under one sync run, so a large coupon list syncs completely and an interrupted sync never retires codes it did not see.
* Sitewide form embed: one form loader across every storefront page, loaded the standard WordPress way — no theme edits, no shortcode per page.
* The checkout opt-in now appears in WooCommerce's block checkout as well as the classic checkout, so shoppers who tick it are synced the same way on both.
* Discount sync now handles large coupon catalogs reliably — sweeps finish in chunks under one sync run, and an interrupted sync never retires codes it did not see.
* History import no longer stops when a store's oldest orders include a refund.


= 1.6.1 =
* WordPress compatibility declaration updated: the plugin is tested up to WordPress 7.1. No feature changes.

= 1.6.0 =
* Refunds and cancellations are now reported to RogalMail, so campaign and automation revenue no longer counts refunded or cancelled orders. Failed reports are retried automatically.
* Purchase totals now reach RogalMail correctly.

= 1.5.0 =
* Product views now count for every shopper, not just identified ones, so Most viewed product feeds fill in from real store traffic.
* Variable products sync their variations too: email product blocks can feature the parent product or any specific variant, each with its own price, image and link.
* Variation sales are reported against the variant, so Best-selling feeds can rank the exact variant that sold.

= 1.4.0 =
* Purchase events now include the order's line items, powering Best-selling product feeds in RogalMail emails.

= 1.3.0 =
* Product sync now also sends each product's short description and its regular (pre-sale) price, so email product blocks can show descriptions and a struck-through old price. Re-run Sync products after updating to fill them in.

= 1.2.0 =
* One key now does everything. The plugin used to ask for two keys with two different names (an API key and an event key) collected from two different pages in RogalMail. The Event key field is gone: your API key also authenticates store events, so there is a single field and a single key to paste. Stores already connected with an event key keep working untouched.
* The settings page now shows a standing connection status beside the Test connection and Sync products buttons: connected or not, when the last test passed and how many contacts the account holds, when products last synced, and when the last store event was sent.

= 1.1.0 =
* New: browse abandonment tracking. When a shopper we can identify views a product and does not buy, the view is reported to RogalMail (once per product per visit, sent in the background so product pages never slow down). Store staff are never tracked. There is a toggle for it in the settings.

= 1.0.2 =
* Updates now arrive through WordPress itself: the plugin checks RogalMail for new versions, and updates appear on the Plugins page and under Dashboard, Updates, ready to install with the normal Update button.
* Added a RogalMail entry to the WooCommerce menu that goes straight to the settings.

= 1.0.1 =
* Declared compatibility with WooCommerce HPOS (custom order tables) and the cart/checkout blocks — the plugin only ever reads orders through WooCommerce's own order objects.
* Added a Settings link to the plugin's row on the Plugins page (the settings live under WooCommerce, Settings, RogalMail).

= 1.0.0 =
* Initial release: customer sync with checkout/registration opt-in, abandoned cart + purchase events, product sync, and the rogalmail_form shortcode.
