=== RIACO Revenue Lift for WooCommerce ===
Contributors: prototipo88
Tags: woocommerce, frequently bought together, upsell, cart progress bar, product bundles
Requires at least: 6.0
Tested up to: 7.0
Stable tag: 1.0.2
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Increase WooCommerce Average Order Value with automatic Frequently Bought Together recommendations, a cart progress bar, and product bundles.

== Description ==

RIACO Revenue Lift for WooCommerce helps store owners increase their Average Order Value (AOV) through three focused features:

**Frequently Bought Together (FBT) Widget**
Automatically suggests products that customers frequently purchase together, based on real WooCommerce order history. No manual configuration needed — the algorithm analyses your existing orders and surfaces high-confidence recommendations. The widget appears on product pages and the cart page with an Amazon-style layout: product cards, per-item checkboxes, live total price, and a single "Add all to cart" button.

**Cart Progress Bar**
Detects your free shipping threshold from WooCommerce Shipping Zone settings and displays a progress bar in the cart. Customers can see exactly how much more they need to spend to qualify — a proven nudge to increase cart value. Works with both classic themes (WooCommerce cart fragments) and FSE/block themes.

**Bundle Products**
Create native WooCommerce bundle products with an optional percentage or fixed-amount discount. Bundle items are listed on the product page, shown in the cart, and recorded in order line item meta. Fully compatible with WooCommerce HPOS.

**Revenue Tracking Dashboard**
Track FBT impressions, clicks, and add-to-cart events locally — no external services required. See which products perform best, measure FBT attributed revenue, and track bundle order revenue. All data stays in your WordPress database.

= Features =

* Automatic FBT recommendations from real order history (no manual setup)
* Amazon-style FBT widget with checkboxes and live total price
* FBT block for FSE/block theme cart templates
* Free shipping progress bar — threshold auto-detected from WooCommerce Shipping Zones
* Cart Progress Bar works with classic themes (fragments) and FSE/block themes
* Native WooCommerce bundle product type with percentage or fixed discount
* Local event tracking: FBT impressions, clicks, add to cart (up to 10,000 events, rolling)
* Revenue attribution dashboard for bundles and FBT
* Compatible with WooCommerce HPOS (High Performance Order Storage)
* PRO-ready architecture with WordPress action/filter hooks throughout
* No external APIs or SaaS dependencies
* Lightweight — assets only loaded on WooCommerce pages

= PRO Extension Points =

The free version is built with a PRO layer in mind. Key filters and actions are exposed throughout:

* `revenuelift_for_woocommerce_free_shipping_threshold` — override the resolved free shipping threshold per user or context
* `revenuelift_for_woocommerce_tracking_event` — enrich or suppress individual tracking events (return `false` to suppress)
* `revenuelift_for_woocommerce_before_fbt_render` / `revenuelift_for_woocommerce_after_fbt_render` — inject content around FBT widgets
* `revenuelift_for_woocommerce_loaded` — hook in after full plugin initialisation

== Installation ==

1. Upload the `riaco-revenue-lift-for-woocommerce` folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Ensure WooCommerce is installed and active.
4. Navigate to **RevenueLift** in the WordPress admin menu to view your dashboard and configure settings.

== Frequently Asked Questions ==

= Does this plugin require WooCommerce? =

Yes. RIACO Revenue Lift for WooCommerce requires WooCommerce 7.0 or higher.

= How does the FBT algorithm work? =

It analyses your WooCommerce order history to find products that have been purchased together most frequently. Only published, in-stock, and priced products are included. You can configure the minimum co-purchase threshold and the maximum number of products shown from the FBT settings page.

= Where is my data stored? =

All data (settings, tracking events, FBT cache) is stored in your WordPress database using standard WordPress APIs (`wp_options`, transients, order meta). No data is sent to external services.

= Will this slow down my store? =

No. Assets are only loaded on WooCommerce pages (product pages, cart, checkout). FBT results are cached per product for 24 hours using WordPress transients and refreshed automatically when orders are completed.

= Can I use this with a caching plugin? =

Yes. The Cart Progress Bar is registered as a WooCommerce cart fragment for classic themes, so it updates correctly even with page caching enabled. For block themes, it uses the WooCommerce Blocks store subscription for live updates.

= How many tracking events are stored? =

Up to 10,000 events are stored on a rolling basis. Older events are automatically removed as new ones are recorded. You can also clear all events from the Dashboard.

= Does this work with High Performance Order Storage (HPOS)? =

Yes. The plugin declares HPOS compatibility and uses the WooCommerce order API throughout.

= What is the Bundle product type? =

When Bundle Products are enabled, a "Bundle" product type becomes available in the WooCommerce product editor. You can add child products, set their quantities, and optionally apply a percentage or fixed discount. The bundle is sold as a single product; child product names and quantities are recorded in order line item meta.

== Screenshots ==

1. Revenue Dashboard — FBT engagement stats (impressions, clicks, CTR) and revenue attribution.
2. FBT Settings — configure the minimum co-purchase threshold and max products shown.
3. Cart Progress Bar Settings — displays the auto-detected free shipping threshold.
4. General Settings — enable/disable FBT Widget, Cart Progress Bar, and Bundle Products.
5. FBT Widget — Amazon-style widget shown below the product description on a product page.
6. Cart Progress Bar — progress bar shown at the top of the cart.
7. Bundle Product Editor — add child products, set quantities, and configure an optional discount.

== Changelog ==

= 1.0.2 =

**Changed**

* Refactored all internal identifiers (PHP constants, class names, option keys, AJAX actions, meta keys, CSS classes, JS globals, hook names) from the `revenuelift_for_woocommerce` / `RevenueLift` prefix to `riaco_rlfw` / `Riaco_RLFW` / `RIACO_REVENUE_LIFT_FOR_WOOCOMMERCE` to align with the plugin slug. No user-facing behaviour changes.
* Fixed admin assets not loading on the Dashboard page after the slug refactor (hook detection now also matches the main menu page slug).

= 1.0.1 =

**Changed**

* Replaced manual upsell product assignments with an automatic Frequently Bought Together (FBT) algorithm that analyses real WooCommerce order history to surface co-purchase recommendations. No manual configuration required.
* Renamed feature "Cart Value Booster" to "Cart Progress Bar" across settings, templates, CSS classes, and order meta keys. A migration helper preserves existing saved values on upgrade.
* Redesigned FBT widget with an Amazon-style layout: product image cards in a horizontal flex row, per-item checkboxes (checked by default), live total price updated on checkbox change, and a single "Add all to cart" / "Add to cart" button.
* Improved FBT block editor preview with realistic placeholder product cards, + separators, and a summary panel with a disabled "Add all to cart" button.

**Added**

* Bundle product type: native WooCommerce product type with optional percentage or fixed-amount discount. Bundle items are shown on the product page, listed in the cart, and recorded in order line item meta.
* FBT Gutenberg block (`riaco-revenue-lift-for-woocommerce/fbt-widget`, category `woocommerce`) for placing the widget inside FSE/block theme cart templates. Supports placement both inside `woocommerce/filled-cart-block` and as a sibling of `woocommerce/cart`.
* FBT order attribution: items added via the FBT widget are tagged with order item meta `_revenuelift_for_woocommerce_source = fbt`, enabling revenue attribution in the dashboard.
* Cart Progress Bar support for FSE/block themes via `wp.data` WooCommerce Blocks store subscription for live updates.
* Enhanced revenue dashboard: FBT attributed revenue and order count (forward-only, from install date), bundle revenue and order count (all-time), FBT impressions/clicks/add-to-cart events with CTR metric.
* FBT cache version bumped to `_v2_` prefix — stale caches from 1.0.0 are automatically ignored.

**Fixed**

* `fbt_max_products` activation default corrected from 4 to 3, matching the server-side clamp and UI `max="3"` attribute.
* Removed debug `console.log` statement from block editor script (`blocks/fbt-widget/index.js`).
* Block editor script `category` aligned to `"woocommerce"` (was `"widgets"`, conflicting with `block.json`).
* Added `index.php` silence files to all plugin subdirectories to prevent directory listing.

= 1.0.0 =

* Initial release.
* Frequently Bought Together widget (manual upsell assignments).
* Cart Value Booster with free shipping progress bar.
* Basic Bundle creator (option-stored, widget-style).
* Local event tracking: impressions, clicks, add to cart.
* Revenue tracking dashboard.

== Upgrade Notice ==

= 1.0.2 =
Internal refactor only — no data migration required. Safe to update.

= 1.0.1 =
Major update: manual upsells replaced with automatic FBT algorithm, Cart Progress Bar replaces Cart Value Booster, new Bundle product type added. Existing settings and data are preserved on upgrade.

= 1.0.0 =
Initial release.
