=== Codayman First Order Coupons for WooCommerce ===
Contributors: saddam987020
Tags: woocommerce coupon, discount, first order discount, new customer discount, first order coupon
Requires at least: 6.3
Tested up to: 7.0
Requires PHP: 7.4
WC requires at least: 8.0
WC tested up to: 10.9.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Restrict any WooCommerce coupon so it can only be redeemed by customers placing their first order.

== Description ==

Codayman **First Order Coupons for WooCommerce** lets store owners create coupon codes that can only be redeemed by customers placing their very first order.

WooCommerce includes powerful coupon functionality, but it doesn't provide a built-in way to restrict coupons exclusively to first-time customers. This plugin fills that gap with a lightweight, native WooCommerce solution that integrates directly into the existing coupon editor.

Simply edit any WooCommerce coupon, enable the First order coupon only option, and the plugin will automatically validate whether the customer has previously placed a qualifying order.

The validation works for both logged-in customers and guest checkouts, ensuring that first-order promotions are applied fairly without requiring additional configuration.

The plugin is lightweight, translation-ready, HPOS compatible, follows WordPress Coding Standards, and integrates seamlessly with WooCommerce.

= Features =

* Adds a "First order only" checkbox to the existing **Usage restriction** tab on every coupon.
* Works for both logged-in customers and guest checkouts (matched by billing email).
* Compatible with WooCommerce High-Performance Order Storage (HPOS).
* Compatible with the WooCommerce Cart and Checkout blocks.
* Compatible with Classic Checkout.
* Supports unlimited coupons.
* Translation ready.
* Lightweight with minimal performance impact.

= How it works =

Order statuses that don't represent a completed or genuine purchase attempt (pending payment, failed, cancelled, and trashed) are ignored when checking a customer's order history, so an abandoned or failed order will not block the customer from later using a first-order coupon. You can adjust which statuses are excluded with the `focw_excluded_order_statuses` filter.

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/codayman-first-order-coupons-for-woocommerce` directory, or install the plugin directly through the WordPress plugins screen.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Make sure WooCommerce is installed and active.
4. Go to **Marketing → Coupons** (or **WooCommerce → Coupons**), create or edit a coupon, open the **Usage restriction** tab, and check **First order only**.

== Frequently Asked Questions ==

= Does this work for guest checkouts? =

Yes. The plugin checks the billing email entered at checkout against past orders in the store, in addition to checking the logged-in customer's account and email when applicable.

= Which order statuses count as a "previous order"? =

Any status except Pending payment, Failed, Cancelled, and Trash. This can be customized with the `focw_excluded_order_statuses` PHP filter.

= Does this create any new database tables? =

No. The plugin stores a single piece of coupon meta data using WooCommerce's own coupon CRUD, and reads existing order data through `wc_get_orders()`.

= Is this compatible with High-Performance Order Storage (HPOS)? =

Yes, the plugin declares compatibility and only queries orders through the WooCommerce CRUD/query APIs.

== Screenshots ==

1. The "First order only" checkbox on the coupon Usage restriction tab.

== Changelog ==

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
