=== GT BOGO Engine — BOGO Deals for WooCommerce ===
Contributors: graphictshirts
Tags: bogo, buy one get one, woocommerce discount, free gift, promotional pricing
Requires at least: 6.6
Tested up to: 7.0
Requires PHP: 8.2
Requires Plugins: woocommerce
Stable tag: 1.4.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add unlimited automatic Buy X Get Y (BOGO) deals to WooCommerce. Multiple rules per product or category, with Badges and a Progress Bar.

== Description ==

**GT BOGO ENGINE** gives your WooCommerce store automatic BOGO deals with zero coupon codes and zero customer friction.

= Free Features =

* **1 Active BOGO Rule** — configure trigger quantity, discount type, and qualifying products
* **Product Badge** — display a BOGO badge on qualifying product images
* **Cart Progress Bar** — show customers exactly how close they are to the deal
* **Analytics Dashboard** — BOGO orders, revenue influenced, discount given, and AOV lift vs store average
* **Deal Health Score** — 0-100 conversion score with specific coaching tips
* **AI Deal Advisor** — connect Anthropic, OpenAI, Gemini, Groq, Mistral, or Cohere for store-specific recommendations
* **Cart Message Generator** — AI-generated cart proximity messages in 6 brand tones
* **Deal Banner** — dismissible announcement bar on shop and cart pages
* **Free Gift Unlocked** — subtle confirmation when the deal activates in cart
* **Quick Add** — one-click buttons to add qualifying products and unlock the deal
* **Mini-cart Badge** — deal status in the WooCommerce mini-cart and drawer
* Full WooCommerce compatibility (Simple, Variable, Grouped products)
* WooCommerce Blocks compatible — works with block cart and checkout
* Lightweight — no external dependencies, no page speed impact

= Upgrade to PRO =

GT BOGO ENGINE PRO adds 200 expert-built rule packs, 48 intelligence superpowers, enterprise analytics, customer lifetime value scoring, A/B testing, geo targeting, multi-currency support, white-label emails, and more — all for $499/year. Visit [graphictshirts.shop/bogo](https://graphictshirts.shop/bogo/) to upgrade.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install via the WordPress plugin installer
2. Activate the plugin through the **Plugins** menu
3. Navigate to **GT BOGO ENGINE** in your WordPress admin sidebar
4. Create your BOGO rules under **BOGO Rules** — add as many as you need for different products or categories
5. Optionally upgrade to PRO at graphictshirts.shop/bogo/

== Frequently Asked Questions ==

= Does this work with variable products? =
Yes. GT BOGO ENGINE supports Simple, Variable, Grouped, and External product types.

= Will it conflict with WooCommerce coupons? =
By default BOGO rules and coupons can coexist. Use the "Exclude Sale Items" setting to prevent double-discounting.

= Is customer data stored? =
No customer PII is stored by the plugin. Analytics track aggregate metrics only.

= Will this slow down my store? =
No. Rules are cached via WordPress transients. The cart calculation hook runs only on cart and checkout pages.

= Does it work with WooCommerce Blocks (Gutenberg cart)? =
Yes. GT BOGO ENGINE Lite is fully compatible with WooCommerce Blocks including the block-based cart and checkout. Discounts are applied server-side and surfaced via the Store API.

= Can I target specific products or categories? =
Yes. Each rule can target specific products, categories, or tags. Create separate rules for different product groups — for example, one deal for t-shirts and another for sweatshirts.


== Upgrade Notice ==

= 1.4.0 =
Unlimited BOGO rules now fully supported with multi-rule targeting, plus a live analytics dashboard and cross-cart reliability improvements. Recommended update.

= 1.2.0 =
Major update: unlimited BOGO rules, 4 new superpowers, AI Deal Advisor with 6 providers, live analytics dashboard, and deal health scoring.


== External Services ==

This plugin includes an **optional** AI Deal Advisor feature. It is disabled by default and only functions if you, the site administrator, choose to enter your own API key for one of the supported AI providers.

When you enable the AI Deal Advisor and provide an API key, the plugin sends a text prompt describing your BOGO deal configuration and aggregate, non-personal store metrics (such as number of orders with a deal applied and average order value) to the AI provider you selected, in order to generate deal recommendations. No customer personal data is sent. No data is sent unless you have entered an API key and triggered the feature.

Supported providers and their terms/privacy policies:

* **Anthropic (Claude)** — endpoint: https://api.anthropic.com — Terms: https://www.anthropic.com/legal/consumer-terms — Privacy: https://www.anthropic.com/legal/privacy
* **OpenAI** — endpoint: https://api.openai.com — Terms: https://openai.com/policies/row-terms-of-use/ — Privacy: https://openai.com/policies/row-privacy-policy/
* **Google Gemini** — endpoint: https://generativelanguage.googleapis.com — Terms: https://ai.google.dev/gemini-api/terms — Privacy: https://policies.google.com/privacy
* **Groq** — endpoint: https://api.groq.com — Terms: https://wow.groq.com/terms-of-use/ — Privacy: https://wow.groq.com/privacy-policy/
* **Mistral AI** — endpoint: https://api.mistral.ai — Terms: https://mistral.ai/terms/ — Privacy: https://mistral.ai/terms/#privacy-policy
* **Cohere** — endpoint: https://api.cohere.ai — Terms: https://cohere.com/terms-of-use/ — Privacy: https://cohere.com/privacy/

If you do not enter an API key, the plugin makes no external requests of any kind.

== Changelog ==

= 1.4.0 =
* Improved: Unlimited BOGO rules are now fully supported — create multiple rules targeting different products, categories, and tags, all applied automatically at checkout
* Improved: Live analytics dashboard now tracks BOGO orders, revenue influenced, discount given, and average order value
* Improved: Cart progress bar, product badges, and deal banner reliability across classic and block-based carts
* Fixed: Rule saving and scheduling now work consistently on fresh installations
* Fixed: Free rule and multiple rules apply together without conflict
* Updated: Tested up to WordPress 7.0

= 1.3.0 =
* Fixed: Plugin name updated — removed Free per WP.org naming guidelines
* Fixed: Plugin slug updated to gt-bogo-engine-bogo-deals-for-woocommerce
* Fixed: All inline script and style tags replaced with wp_enqueue_script / wp_add_inline_script
* Fixed: AJAX autosave_settings uses strict option key whitelist instead of prefix-only check
* Fixed: Text domain standardized to gt-bogo-engine throughout all files
* Fixed: JS localization object names prefixed correctly (gtbogoAdminData, gtbogoFreeRuleData, gtbogoDashData)
* Fixed: Global variable $_gt_tab renamed to $gtbogo_tab for correct prefix length
* Fixed: Option key gt_bogo_migration_snapshot renamed to gtbogo_migration_snapshot
* Fixed: Chart.js updated from v4.4.1 to v4.4.8
* Fixed: External service URLs in readme.txt updated to stable endpoints
* Fixed: Banner/screenshot assets removed from plugin ZIP (uploaded separately via SVN)

= 1.2.0 =
* Added: Rules Manager — unlimited custom inventory rules targeting products, categories, and tags
* Added: Product targeting rules — create separate BOGO rules per product line (T-Shirts, Sweatshirts etc)
* Added: Tags targeting and exclude sale items toggle per rule
* Added: Schedule rules with start and end dates
* Added: Priority field with conflict detection
* Added: Per-rule analytics — impressions, conversions, revenue influenced
* Updated: WooCommerce tested up to 7.0
* Updated: Plugin name and slug updated per WP.org naming guidelines
* Fixed: AI advisor hex color bug in step titles
* Fixed: System Status page title cleaned to uppercase

= 1.1.0 =
* Added: Rules Manager — create unlimited BOGO rules per product or category
* Added: Live Analytics dashboard with 60-second polling, sparkline chart, KPI cards
* Added: AI Deal Advisor with 6 provider support (Anthropic, OpenAI, Gemini, Groq, Mistral, Cohere)
* Added: AES-256-CBC encryption for AI provider API keys
* Added: Cart abandonment coaching card on dashboard
* Added: Social proof counter in cart progress bar
* Added: Configuration export and import with strict field whitelist
* Added: Live product inventory AJAX handler with stock status awareness
* Added: 4 new superpowers: Deal Banner, Deal Unlock, Quick Add, Mini-Cart Badge
* Added: API key format validation per provider
* Fixed: System Status page title cleaned to uppercase
* Security: All direct DB queries annotated with phpcs:ignore comments
* Security: Import validator — enum validation, integer-only ID arrays, 64KB size limit

= 1.0.0 =
* Initial release of GT BOGO ENGINE Free.
* Core rule engine: create unlimited Buy X Get Y rules, each targeting different products or categories — no coupon codes required.
* Works with WooCommerce Blocks cart and classic cart — fully compatible with modern WC setups.
* Quick Start Templates: three one-click templates that pre-fill a new rule so you can go live in under two minutes.
  * Buy 1 Get 1 at 50% Off
  * Buy 2 Get 1 Free
  * Spend $50 Save $10
* Cart Proximity Nudge: shows customers how close they are to unlocking the deal.
* Deal Preview panel: see exactly what your customers will see before going live.
* Analytics dashboard: four real KPIs from your order data — orders with deal, total savings given, deal AOV, and best performing day.
* Progress Bar superpower: visual cart progress indicator on the cart page.
* Badge Generator superpower: product badge showing active deal on qualifying items.
* WooCommerce Blocks compatible: works with the modern React-based cart and checkout.
* Privacy-first: no tracking, no telemetry, no analytics sent to us. The optional AI Deal Advisor only contacts an AI provider if you add your own API key (see External Services below).
* Built on the same engine that powers GT BOGO ENGINE PRO — the enterprise-grade WooCommerce promotional intelligence platform used by stores across 19 industries.

