=== Order Boost — First Order Discounts ===
Contributors: digitallychee
Tags: woocommerce, discount, coupon, first order, new customer
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 8.3
Stable tag: 1.0.4
License: GPL-3.0-or-later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Reward first-time buyers with automatic discounts. Simple, fast WooCommerce conversion boost.

== Description ==

**What Order Boost does**
- Detects **new customers** (logged-in: by user ID & paid-ish orders; guests: by billing email).
- Applies a **negative fee** as a discount in the cart/checkout:
  - **Percentage** or **Fixed amount**
  - **Minimum subtotal** (ex. tax) threshold
  - Option to **include sale items** in the threshold
  - Option to **skip when coupons are present** (prevents stacking)
  - Option to mark discount **taxable** (off by default)

**Where to configure**
- Go to **Marketing → First Order Discounts**.

**Why a fee and not a coupon?**
- Predictable totals, minimal conflicts with coupon logic, and clearer reporting. Need a real coupon? You can filter the label or adapt to an auto-applied coupon if preferred.

== Pro Version ==

Enhance your store's incentives with Order Boost Pro - First & Second Order Discounts, which expands the free plugin's functionality by allowing discounts to be applied to either the first or the second order.

**What the Pro version adds**
- Apply the automatic discount to the second order, not just the first
- Use the same configurable rule set (type, amount, minimum subtotal, taxability, sale-item rules, etc.)
- Includes priority support and ongoing updates

**Why upgrade?**
Rewarding returning customers is an effective way to increase repeat purchases. The Pro version makes this effortless by applying your discount logic to a customer's second order-no coupons, no manual setup.

**Get Pro**
Purchase a licence here:
[Buy an Order Boost Pro licence](https://woocommerce.com/products/dl-order-boost-pro)

**💡 Note:**
- In the block-based checkout, WooCommerce only recalculates totals once enough billing details are entered to validate the customer. Typing an email alone will not immediately update prices — but any eligible discount is always applied automatically before the order is completed.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/dl-order-boost/` or install via ZIP.
2. Activate the plugin.
3. Visit **Marketing → Order Boost** and set your defaults (type, amount, threshold, etc.).

== Frequently Asked Questions ==

= How does it detect a “new customer”? =
- Logged-in: checks `wc_get_customer_order_count()` and also queries for any orders with statuses `processing`, `completed`, or `on-hold`. If any exist, they’re not new.
- Guest: looks up paid-ish orders by **billing email**. If found, they’re not new.

= Which order statuses count as previous orders? =
`processing`, `completed`, and `on-hold`. You can adjust by editing the status list in the code.

= Does the discount appear as soon as a guest types their email in the block checkout? =
Discount eligibility for guest customers is checked as part of WooCommerce's checkout totals calculation. Simply entering an email address does not trigger totals to update in the block-based checkout. WooCommerce recalculates totals automatically once the customer completes their billing details 
(for example, after address fields are filled or when using autofill). At that point, any eligible first-order discount will appear. The discount will always be applied before the order is placed if the customer is eligible.

= Does this plugin create a coupon code? =
No. The discount is applied automatically as a fee/discount at checkout when the rules are met.

= Does it stack with other coupons? =
By default **no** (there’s a “Skip if coupon applied” option). You can allow stacking by unchecking that option.

= Taxes? =
By default the discount reduces the **pre-tax** subtotal (non-taxable fee). You can mark it taxable in settings if your locale/accountant prefers that model.

= Multi-currency / compatibility? =
Runs late enough (priority 20) to play nicely with most currency switchers. Always test on staging with your stack.

= Is it compatible with HPOS (High-Performance Order Storage)? =
Yes, Order Boost declares compatibility with WooCommerce custom order tables / HPOS.

== Screenshots ==
1. Settings page under Marketing → First Order Discount.

== Changelog ==

= 1.0.4 - 2026-05-23 =
* Minor internal clean-ups and code formatting improvements.
* Upgraded for compatibility with WordPress 7.0.

= 1.0.3 - 2026-02-04 =
* Minor internal code refactoring.
* Clearer path to upgrade to the Pro version, for enhanced benefits.

= 1.0.2 — 2026-01-09 =
* Minor internal code refactoring.

= 1.0.1 — 2025-12-04 =
* Improved discount eligibility detection for guest customers.
* Discount now applies automatically after email entry on checkout (no page reload needed).
* Ensures accurate first-order validation when using the classic checkout AJAX flow.
* Minor code cleanup and improved compatibility with dynamic checkout updates.

= 1.0.0 — 2025-12-03 =
* Initial release.

== Upgrade Notice ==

= 1.0.3 =
Upgraded for compatibility with WordPress 7.0.

== Uninstall ==

The plugin includes an `uninstall.php` that **fully deletes** its saved options (`dl_order_boost_settings_v1`). Multisite-safe.

== Author ==

Created by **Digital Lychee** — https://digitallychee.com
