=== Valabi Smart Offers ===
Contributors: valabi
Tags: woocommerce, upsell, cross-sell, frequently bought together, free gift
Requires at least: 5.8
Tested up to: 6.6
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Smart promotions engine for WooCommerce — gifts and discounts by cart contents, spend thresholds, free shipping, choose-your-gift, BOGO, and "frequently bought together". Fully translatable (English source, Persian included).

== Description ==

Valabi Smart Offers turns one rule engine into many promotion types. Every offer is a Trigger → Conditions → Reward → Display row, so category deals, spend thresholds, free gifts, discounted add-ons and free shipping are all configured the same way.

Two offer sources, one click-to-accept pipeline:

* **Cart-based rules** (the "Offers" screen) react to what is in the cart — categories, products, item quantity, or subtotal — and reward a free/discounted product or free shipping.
* **Frequently bought together** bundles (set on the product editor) show up to 3 companion products under the add-to-cart button, each with its own discount. Companion discounts apply only while the main product stays in the cart.

Three display surfaces, all driven by the same offer card:

* Post-add-to-cart popup
* Small order-bump card above the Place Order button
* Progress bar ("spend X more for a free gift / free shipping")

Other features:

* Click-to-accept (nothing is auto-added) — fewer surprises, fewer edge cases
* Stacking vs exclusive offers, priority ordering
* Exclude sale items from conditions
* Campaign scheduling (start/end)
* Per-offer analytics: impressions, accepts, conversion rate, attributed revenue
* Bilingual FA/EN, RTL admin with inline how-to guides on every field
* HPOS compatible

Truthful pricing: the "before" price is always the product's real price — the plugin never fabricates a strike-through.

== Changelog ==

= 1.1.0 =
* Removed the license system — the plugin no longer needs a key and is always active (no gate, no License screen). Replaced with a silent once-a-day technical usage ping (site URL + plugin/WP/WC/PHP versions); no UI, never blocks the site. Disable via the VALABI_SO_TELEMETRY_OFF constant or the valabi_so_telemetry_enabled filter.

= 1.0.3 =
* Fixed license activation: after saving a key you are no longer sent to a "you are not allowed to access this page" screen — you land on the Offers list. The License menu now sorts LAST under the Offers menu instead of first.
* Fixed front-end 404s after activation: rewrite rules are flushed once automatically when the gate first opens.

= 1.0.2 =
* Security/privacy — the license key is no longer pre-filled in the settings field (only a masked "current key" hint is shown), and the validation endpoint URL is no longer displayed. Submitting the form with the key field left blank now re-validates the existing key instead of wiping it.

= 1.0.1 =
* License activation — the plugin now validates a manually-issued license key against the Valabi license server. Without a valid key the offer features stay off and the settings are hidden, but the store keeps working normally (no errors, checkout unaffected).
* Fail-safe by design — the license check never makes the storefront slow or fragile: the gate reads cached state only, validation runs on a daily cron, and a temporarily unreachable server keeps an active site working within a grace window.
* First stable release.

= 0.7.0 =
* Accent color schemes — pick from 6 shades (Magenta default, Violet, Ocean, Emerald, Sunset, Graphite) under Settings → Accent color; recolors the popup, checkout bump, progress bar and product boxes.
* Popup polish — cleaner background-less close button (crisp X icon), sharper text rendering, and a higher-contrast product card so the modal no longer looks washed out.
* Fixed: with popup frequency set to “Every time it qualifies”, the popup now reliably re-shows on every qualifying add-to-cart instead of only the first time.

= 0.6.0 =
* Choose-your-gift upgrades — each candidate can now carry its own discount (one gift free, another at 50% off, etc.), and customers can pick more than one gift ("pick any N of M").
* Progress bar by quantity — the bar now tracks a quantity goal (whole cart, a category, or a product), not only a spend threshold, with messages phrased in the goal's own units.
* Frequently-bought-together on the cart page — a new "Complete your order" box aggregates the FBT companions of everything in the cart; toggle it under Settings → Cart-page suggestions.
* Persian translation and .pot updated for all new strings.

= 0.5.0 =
* Stock guard — offers auto-hide when the reward product is out of stock or not purchasable.
* Refund-aware analytics — attributed revenue and redemption counts are reversed when an order is refunded or cancelled.
* Subtotal threshold now nets out coupon discounts already applied to the cart.
* New reward type — Percentage off the whole cart.
* Exclusions & targeting — “cart does NOT contain” products/categories, user-role targeting, and new-customer (first-order) targeting.
* Coupon-stacking control — option to hide offers when a coupon is already applied.
* Popup frequency cap — show the popup every time, once per session, or once per day.
* Countdown urgency — optional real per-visitor countdown timer in the popup.

= 0.4.0 =
* Internationalization: all source strings are now English with a complete shipped Persian (fa_IR) translation, plus a .pot template — the plugin is now translatable into any language while Iranian stores still read Persian out of the box.
* First-run onboarding: a welcome notice with one-click “create a sample offer” so a merchant sees a working, pre-filled offer in seconds.

= 0.3.0 =
* New reward type — Choose-your-gift: offer a few products and let the shopper pick one free/discounted, with a polished selectable grid in the popup and checkout bump.
* New reward type — BOGO / quantity-scaled gifts: "buy X of a product/category, get M" with the gift quantity rescaling live as the cart changes.
* Storefront UI redesign: refined magenta-on-white component system (popup, checkout bump, progress bar, FBT) with soft shadows, spring motion, accessible focus states, reduced-motion support, and full RTL.

= 0.2.0 =
* Performance gate: the storefront engine (hooks, AJAX, assets) only loads when at least one offer or FBT bundle is actually configured — a store with nothing set up pays a single autoloaded option read and zero queries. Surfaces register only when used and enabled.
* Gift quantity is locked — a gift line can no longer be multiplied for extra discount.
* One gift per offer — an accepted offer stops showing on every surface and cannot be added twice.
* Usage limits — per-customer (logged-in) and global redemption caps, counted on paid orders.
* A clear cart notice now explains when a gift has reverted to full price instead of charging silently.
* Checkout-bump on/off toggle added to settings.

= 0.1.0 =
* Initial release: cart-rule engine, FBT bundles, popup + checkout bump + progress bar, click-to-accept gift mechanic, free shipping reward, per-offer analytics.
