=== ByticsLab Conditional Offers for WooCommerce ===
Contributors: tripleten
Tags: woocommerce, promotions, free gift, buy one get one, discounts
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
WC requires at least: 8.9
WC tested up to: 11.0.1
Stable tag: 1.0.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Donate link: https://paypal.me/lklalitesh

A rule-driven conditional promotions engine for WooCommerce — Buy X Get Y, spend-based free gifts, category offers, and more.

== Description ==

ByticsLab Conditional Offers for WooCommerce is a promotion engine, not a single-purpose "free gift" plugin: administrators build promotions from reusable conditions (cart subtotal, product/category quantity or subtotal, coupon used, date range, and more) and rewards (free product, choose-your-gift), and the same engine evaluates every promotion type — Buy X Get Y, Spend X Get Y, category offers, tiered offers — rather than one hardcoded code path per offer type.

Built and maintained by ByticsLab — https://www.byticslab.com

**Version 1.0.3.** The full engine, admin builder, storefront UI (classic + WooCommerce Blocks, both with the full usage-limit/order lifecycle), settings, logging, promotion tester, usage limits, order audit data, privacy export/erase + retention cleanup, promotion analytics with translated script strings and correct currency formatting, a 598-test automated suite, a clean `wp-content/plugins/plugin-check` pass (0 errors), developer documentation (`README.md`), sample promotion configs (`samples/`), and a freshly-regenerated translation `.pot` file are all in place: plugin activation, database schema, HPOS compatibility, the promotion engine core, the free-tier condition library, the free-tier reward/gift system, cart/checkout hook integration (classic + Blocks), the admin promotion builder (with a real, always-visible tab bar), the storefront gift UI/messaging/progress bar, a global settings screen (WooCommerce → Conditional Offers → Settings) with a real Analytics tab, optional WooCommerce-logging-backed debug logging, an admin "Test Promotion" simulator, per-customer usage limits reserved the moment a promotion is decided (not just at checkout), and order/order-item metadata.

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/byticslab-conditional-offers-for-woocommerce`, or install directly through the WordPress admin (Plugins → Add New → Upload Plugin).
2. Activate the plugin through the "Plugins" screen in WordPress.
3. Requires WooCommerce 8.9 or later to be installed and active.

= Multisite =

This plugin is site-scoped only: it does not support Network Activation, and activation will be refused with an explanatory notice if attempted network-wide. On a multisite install, activate it individually on each site that needs it, via that site's own Plugins screen. Each site gets its own independent set of promotions, settings, and database tables — nothing is shared network-wide.

== Screenshots ==

1. Choosing a promotion type — five guided builders, each naming the condition/reward pair it uses under the hood.
2. The promotion editor filled in for a real "Buy X Get Y" promotion — trigger product, quantity, and gift product/quantity.
3. The Promotions list, showing several active promotions with their type, status, priority, and usage.
4. The Analytics tab — gifts awarded, orders with a promotion, and estimated gift value, with real currency formatting.
5. A real storefront cart with a promotion-triggered gift line (a free product alongside its normal savings badge).

== Changelog ==

= 1.0.3 =
* Fixed: the order-edit screen now shows a friendly "Promotion gift: `<name>`" line instead of raw internal meta keys.
* Fixed: Analytics figures now display with your store's own currency symbol.
* Improved: a persistent navigation bar lets you move between Promotions, Analytics, and Settings from any screen.
* Improved: redesigned Analytics summary cards for better readability.
* Improved: consistent header and page layout across every admin screen.
* Improved: the promotion editor groups related fields (status/priority, product/quantity, etc.) onto the same row, with clearer labels and a helpful example placeholder.
* Improved: admin notices for a missing or outdated WooCommerce install are now shown only to users who can act on them.
* Now built and maintained by ByticsLab.

= 1.0.2 =
* Fixed across three further independent review rounds on the reservation/confirmation/release integrity path (3 P1 + 1 P2 + 1 P3 finding overall) — multi-promotion confirmation and confirmed-usage release made genuinely atomic (single-transaction, no compensating-call window), counter-decrement failures no longer ignored anywhere, stale `.pot`/`package-lock.json` metadata regenerated. 587 tests total across 11 suites. Full details: `CHANGELOG.md` in this plugin's own folder.

= 1.0.1 =
* Fixed after a further independent review (4 P1 + 4 P2 findings) — reservation TTL not refreshing on idempotent retry, privacy export/erasure pagination stopping after 10 orders, a non-deadlock reservation INSERT failure corrupting counters, the compiled admin bundle shipping with no source, usage confirmation failing open, analytics conflating uses with gift quantity, untranslatable admin UI strings, and an oversized readme. 548 tests total across 11 suites. Full details: `CHANGELOG.md` in this plugin's own folder.

= 1.0.0 =
* Phase 12 (per-request query memoization eliminating a duplicate cart-hot-path SQL query) and Phase 13 (packaging: `README.md`, `samples/`, the translation `.pot` file, `load_plugin_textdomain()`, and a verified real-install packaging test) — 529 tests total across 11 suites. Full details: `CHANGELOG.md` in this plugin's own folder.

= 0.12.0 =
* Fixed after an independent review of Phases 8-11 (3 P1 + 5 P2 findings) — Blocks checkout bypassing the usage/order lifecycle, non-atomic usage confirmation, missing privacy export/erase/retention, reservation-lifecycle timing, an unavailable gift still listed as choosable, the missing analytics screen, weak nested-field REST validation, and a failing JS lint gate. 525 tests total across 11 suites. Full details: `CHANGELOG.md` in this plugin's own folder.

For the complete version history (every release back to 0.1.0), see `CHANGELOG.md` in this plugin's own folder.
