=== YeeDiscounts - Dynamic Pricing & Discounts for WooCommerce ===
Contributors: addonsorg
Tags: woocommerce, dynamic pricing, discounts, bulk discount, shipping discount
Tested up to: 7.1
Stable tag: 2.1.0
WC requires at least: 4.0
WC tested up to: 11.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

YeeDiscounts allows you to create bulk discounts, BOGO deals, cart discounts, shipping discounts, and advanced dynamic pricing rules for WooCommerce.

== Description ==


[youtube https://www.youtube.com/watch?v=57clErJvQCs]

**YeeDiscounts - Dynamic Discounts for WooCommerce** is the ultimate pricing and discount toolkit for your store. Create simple to complex discount rules to boost sales, including Bulk Discounts (Tiered Pricing), Buy X Get X (BOGO), Buy X Get Y, Cart Discounts, Shipping Discounts, and more.

The plugin is designed to be lightweight, easy to use, and fully compatible with **WooCommerce High Performance Order Storage (HPOS)** and modern **Checkout Blocks**.

Pro Version: <https://add-ons.org/plugin/yeediscounts-pro/>
Document: <https://yeeplugin.github.io/YeeDiscounts/index.html>

### Features

*   **Two Application Methods**: Choose between **Automatic** (applied seamlessly at cart/checkout) or **Discount Code** (customers enter promo code at checkout with virtual coupon bridge).
*   **Simple Discounts**: Percentage, Fixed Amount, or Fixed Price adjustments per product.
*   **Bulk Discounts (Tiered Pricing)**: Setup quantity-based discounts (e.g., Buy 3-4 get 10% off, Buy 5+ get 20% off). Display tiered pricing tables on product pages.
*   **Buy X Get X (BOGO)**: Classic Buy One Get One Free/Discounted logic. Supports recursive rules (Buy 2 Get 1, Buy 4 Get 2...).
*   **Buy X Get Y**: Buy specific products/categories, get the same or different products for free or discounted (supports Auto Add, Cheapest in Cart, or Most Expensive in Cart).
*   **Cart Discounts**: Apply percentage or fixed discounts to the entire cart total. Supports applying as a Coupon or Fee.
*   **Bundle / Set Discounts**: Fixed price or percentage discount for a bundle of items (e.g., Buy 3 items for $100 or save 15%).
*   **Shipping Discounts**: 
    *   **Free shipping (100% off)**: Grant free shipping when qualifying conditions are met.
    *   **Percentage discount on shipping**: Deduct a percentage from the shipping cost (e.g., 50% off shipping).
    *   **Fixed amount discount on shipping**: Deduct a fixed amount from shipping fees (e.g., $5.00 off shipping).
    *   **Method Targeting**: Apply to all shipping methods or specific shipping methods/zones only.
*   **Coupon Code Displays on Store Pages**:
    *   **All Pages (Sitewide Bar)**: Floating bottom promo bar announcing active discount codes with click-to-copy.
    *   **Single Product Page**: Embedded coupon code block with customizable position and click-to-copy buttons.
    *   **Cart & Checkout Pages**: Available coupon cards with one-click **Apply** button to automatically apply the code without manual typing.
    *   **Rule-level Visibility**: Toggle whether each coupon is publicly listed or private.
*   **Customer Account "My Coupons" Tab**:
    *   Adds a dedicated **My Coupons** tab in WooCommerce `My Account` (`/my-account/my-coupons`).
    *   Displays all active coupons eligible for the logged-in customer (filtered by email, role, date, and usage limits).
    *   Includes expiration dates, discount details, click-to-copy, and direct "Use Now" cart links.
*   **Customer Eligibility**: Target rules to All Customers, Specific Customer Roles / Segments, or Specific Customer Emails.
*   **Usage Limits**: Limit total usage count and enforce "Limit to one use per customer" (tracks user ID and billing email).
*   **Active Dates Scheduling**: Schedule start date/time and optional expiration end date/time.

### Advanced Conditions

Target your discounts precisely with a wide range of conditions:

*   **Cart Conditions**: Subtotal, Item Quantity, Line Item Count, Weight, Applied Coupons, Payment Method.
*   **Product Conditions**: Specific Products, Categories, Tags, Attributes, SKUs, On-Sale Status.
*   **Customer Conditions**: User Role, Logged-in Status, Email (specific or wildcard).
*   **History Conditions**: First Order, Last Order Amount, Total Spent, Number of Previous Orders.
*   **Geographic**: Shipping/Billing Country, State, City, Zipcode.
*   **Date & Time**: Date range, Time range, Days of the week.

### Frontend Features

*   **Discount Bar**: Display a progress bar or notification message to encourage customers to meet discount conditions (e.g., "Add $20 more to get 10% off").
*   **Bulk Discount Table**: Automatically display tiered pricing tables on product pages.
*   **Sale Badges**: Custom "On Sale" badges with dynamic labels (e.g., "Save 20%") or hiding badges unless rules match.
*   **Strikeout Prices**: Show original vs. discounted prices clearly in Shop, Product, and Cart pages.

### Admin & Management

*   **Modern Shopify/Coupons Style UI**: Two-column layout with real-time sidebar summary preview and quick actions.
*   **Dedicated Menu**: Integrated under Marketing / Coupons for fast access.
*   **Reports**: Track detailed performance metrics for each individual rule (orders count, total discount amount, order list).
*   **Import/Export**: Easily migrate rules between sites via JSON.
*   **Order Tracking**: Full discount details and rule IDs are saved to order items, fees, and shipping items for reliable analytics.

### Upcoming Features & Development Roadmap

We are actively expanding YeeDiscounts with advanced promotional features. Upcoming roadmap items include:

*   **Exclusive & Priority Rules**: Mark specific rules as exclusive to disable all other rules/coupons when applied, or configure discount stacking priority (Best discount vs. Cumulative).
*   **Exclude On-Sale Items**: Global or per-rule toggle to prevent discounts on products that already have a WooCommerce sale price.
*   **Auto-Add Free Gifts**: Automatically add gift products ($0) to the cart upon meeting order criteria, plus a customer gift selection popup modal.
*   **Multi-Tier Cart Progress Bar**: Multi-step reward progress bar (e.g., Spend $20 for Free Shipping -> Spend $50 for 10% off -> Spend $100 for a Free Gift) for cart and slide-out mini-cart.
*   **Shareable Auto-Apply Coupon URLs**: Direct URLs (`?apply_coupon=CODE`) that automatically apply discounts upon clicking from marketing campaigns or social media.
*   **Customer Lifetime & VIP Tiers**: Automatic discount tiers based on customer lifetime total spent (Bronze, Silver, Gold, VIP tiers) and birthday discounts.
*   **Exit-Intent & Gamification**: Exit-intent discount popups, countdown urgency timers, and lucky wheel voucher rewards.
*   **Multi-Currency & Multi-Language Support**: Automatic exchange rate conversion for fixed-amount discounts across multi-currency plugins (CURCY, FOX, WPML, Polylang).
*   **REST API & Webhooks**: Headless REST API endpoints for mobile apps/POS and webhooks for usage limit/expiration alerts.

== Installation ==

1.  Upload the plugin folder to `/wp-content/plugins/`
2.  Activate **YeeDiscounts - Dynamic Discounts for WooCommerce**
3.  Go to **Marketing > Dynamic Discounts** (or **WooCommerce > Dynamic Discounts**) to create and manage rules.

== Screenshots ==

1.  **Rules Table**: Modern Shopify/Coupons styled rules list with method badges, status pills, and filters.
2.  **Rule Editor**: Clean two-column editor with live summary preview.
3.  **Reports Dashboard**: Comprehensive analytics on discounts and order performance.

== Changelog ==
= 2.1.0 =
*   Feature: Added Popup Modal ("View Available Coupons") for Product, Cart, and Checkout pages with customizable trigger settings.
*   Feature: Real-time Coupon Code tooltip with hover preview on Announcement Bar.
*   Feature: Enhanced "My Coupons" dashboard with distinct Used status watermark and status pill.
*   Feature: Multi-use customer tracking with duplicate voucher card rendering (both Used and Available states).
*   Feature: Full HPOS and WooCommerce Blocks OrderController compatibility.

= 2.0.0 =
*   Feature: Added Frontend Coupon Code Displays on All Pages (sitewide floating bar), Single Product, Cart, and Checkout pages.
*   Feature: One-click "Copy Code" with instant visual feedback and "Quick Apply" on Cart/Checkout.
*   Feature: Added WooCommerce Customer Account > "My Coupons" endpoint and dashboard.
*   Feature: Per-rule public/private toggle ("Display this coupon code publicly").
*   Feature: Added comprehensive Shipping Discounts (Free shipping 100% off, Percentage discount, and Fixed amount discount on shipping fees).
*   Feature: Added option to target All shipping methods or specific shipping methods/zones.
*   Feature: Automatic shipping cache reset on coupon apply/remove for real-time shipping rate recalculation.
*   Feature: Two Application Methods - Automatic vs. Promo Code with WooCommerce Virtual Coupon bridge.
*   Feature: Customer Eligibility block (All customers, User Roles, Specific customer emails).
*   Feature: Usage limits (Total usage limit & One use per customer tracking).
*   Feature: Active dates with start and end date/time scheduling.
*   Feature: Individual rule report view with quick navigation and order audit table.
*   Enhancement: Redesigned rules table and editor in modern Shopify/Coupons style with live sidebar preview.
*   Enhancement: Added default sample rules covering all 7 discount types (disabled by default).
*   Fix: Resolved block visibility and script handling in rule editor.

= 1.1.0 =
*   Fixed: Buy X Get Y - Cheapest in Cart

= 1.0.3 =
*   Fix: Setting "Choose how the discount rules should apply"

= 1.0.2 =
*   Fix: UI tweaks for admin rule editor.

= 1.0.1 =
*   Feature: Added Reports section.
*   Feature: Added Import/Export rules.
*   Feature: Added Order Tracker to save rule details to order items/fees.
*   Enhancement: Refined Buy X Get Y logic (auto-add and sync).
*   Enhancement: Improved handling of Recursive BOGO rules.
*   Fix: UI tweaks for admin rule editor.

= 1.0.0 =
*   Initial release.