=== Unagui First Order Coupon for WooCommerce ===
Contributors: Unagui
Tags: woocommerce, coupon, discount, lead capture, first order
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Requires Plugins: woocommerce
Stable tag: 1.1.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html


First order restrictions, dynamic AJAX coupon generation, and native settings panel in WooCommerce.

== Description ==

Get more sales by capturing leads and offering exclusive first-order coupons!
Unagui - First Order Coupon & Lead Capture is the ultimate, lightweight solution to incentivize new customers in your WooCommerce store. It automates the creation of discount coupons valid only for the first purchase, preventing returning customers from abusing welcome discounts.

### 🚀 Free Version Features:

*   **Strict First Order Restriction:** Adds a new coupon restriction rule in WooCommerce to limit the use of any coupon solely to users who have not completed or processed any previous order (automatic verification by email or user ID).
*   **Elementor Pro Forms Integration:** Dynamically generates unique coupons when a user registers through an Elementor Pro form (form name: `unagui_lead_form`).
*   **Coupon Delivery via Email:** Automatically sends the generated discount code to the customer's email address via the internal WordPress mail system (`wp_mail`), fully compatible with external SMTP plugins.
*   **Integrated Settings Panel:** Elegant configuration panel integrated into the unified "Unagui Plugins" menu where you can customize coupon prefixes, percentage/fixed discount, amounts, and validity days.
*   **Native Shortcode:** Use the [unagui_lead_form] shortcode to easily display a responsive AJAX lead capture form anywhere on your site.

### 🔥 Unlock the power of the Pro version:

Looking to maximize ROI and centralize your leads? Visit [Unagui Shop](https://shop.unagui.es) and upgrade to the Pro version to get:

*   **Direct CRM Integrations:** Native connection with Brevo API, Mailchimp, and MailerLite.
*   **Exclusive Elementor Widget:** Capture leads natively with a built-in widget tailored for Elementor.
*   **Advanced Coupon Restrictions:** Exclude sale products, set minimum spends, and automatically exclude specific categories.
*   **Reports and Analytics:** Dashboard with detailed statistics on generated coupons, used coupons, recovered revenue, and conversion rate.

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/unagui-first-order-coupon` directory, or install the plugin through the WordPress plugins screen directly.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Go to Unagui Plugins > First Order Coupon to configure the basic parameters.
4. Design a form in Elementor Pro, set its name to `unagui_lead_form` in the settings, and you're done!

== Frequently Asked Questions ==

= Does it require WooCommerce installed? =
Yes, this plugin is developed specifically for WooCommerce stores.

= How are coupon emails sent in the free version? =
It uses the native `wp_mail()` function. If you have an external SMTP server or an SMTP plugin like "WP Mail SMTP" configured, the email will be sent through that platform transparently.

= Can customers use the coupon multiple times? =
No, the generated coupon is configured with a single use limit (1) and is restricted to customers with no processed or completed orders in your store's history. Furthermore, the coupon is strictly restricted to the email address entered in the lead capture form.

= How can I display the lead capture form without Elementor Pro? =
You can use the native shortcode `[unagui_lead_form]` to display a beautiful AJAX-powered form on any page or widget.

== Changelog ==

= 1.1.0 - 2026-07-08 =
* Add: Privacy Policy consent checkbox settings for the native shortcode form.
* Add: Suggested privacy policy text block using WordPress native privacy tools.
* Bump: Tested compatibility up to WooCommerce 7.0 and WP 7.0.

= 1.0.0 - 2026-07-06 =
* Initial stable release.
* Add: Dynamic native shortcode [unagui_lead_form] with AJAX submission for non-Elementor users.
* Add: Admin settings panel for default shortcode configuration (email, name toggle, button label).
* Add: Admin email notification containing the lead details and generated coupon code.
* Fix: Elementor Pro legacy form compatibility with PHP 8.0+ by refactoring the settings array iteration.
* Fix: Adherence to WordPress Coding Standards (WPCS) including i18n placeholders, output escaping, and nonce sanitization.
