=== ZenCoupon AI Assistant – AI Coupon Generator & WooCommerce Automation ===
Contributors: tusherikbal
Tags: woocommerce, coupon, ai, automation, abandoned-cart
Requires at least: 5.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.1.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Create AI-powered WooCommerce coupons, automate coupon emails, and run segmented campaign workflows.

== Description ==

**ZenCoupon AI Assistant** helps WooCommerce store owners create, manage, and automate coupons using simple natural-language commands.

Instead of manually setting every coupon field, you can write a prompt like **"Create a 20% Eid sale coupon with minimum spend 1000 and expiry next Friday"**. The plugin converts your instruction into WooCommerce coupon settings that can be reviewed and created from the WordPress admin dashboard.

ZenCoupon AI Assistant combines three main tools:

* AI-powered WooCommerce coupon generation
* WooCommerce coupon email automation
* Functional beta AI Campaign Builder for segmented promotional outreach

### Why Use ZenCoupon AI Assistant

🔥 Create WooCommerce coupons using natural-language prompts  
⭐ Edit and manage generated coupons from the admin dashboard  
⭐ Choose between Groq, OpenAI/GPT, and Google Gemini  
⭐ Generate structured coupon rules without manual setup  
⭐ Automate coupon emails for customer lifecycle events  
⭐ Send first-order, welcome, new-order, thank-you, order-status, and abandoned-cart coupon emails  
⭐ Build campaign drafts from natural-language campaign ideas  
⭐ Preview target customers and remove recipients before campaign launch  
⭐ Send admin test emails before starting a campaign  
⭐ Generate customer-specific WooCommerce coupons  
⭐ Use REST API and MCP-compatible integration endpoints  

### AI Coupon Generator

ZenCoupon AI Assistant can create and update WooCommerce coupons from plain-language instructions.

Supported coupon settings include:

* Coupon code
* Percentage discount
* Fixed cart discount
* Fixed product discount
* Expiry date
* Minimum and maximum spend
* Usage limits
* Usage limit per user
* Individual use only
* Free shipping
* Exclude sale items
* Product and category restrictions
* Email restrictions

Example prompts:

* Create a 15% discount coupon for Summer Sale.
* Create BLACKFRIDAY coupon with 30% discount.
* Create a fixed 500 discount coupon with minimum spend 3000.
* Create a free shipping coupon for VIP customers.
* Update the latest coupon and change the discount to 20%.

### WooCommerce Automation

ZenCoupon AI Assistant includes coupon email automation for common WooCommerce customer events.

Available automation workflows:

* First-order coupon automation
* Welcome / account-created coupon automation
* New-order coupon automation
* Thank-you coupon automation
* Order-status based coupon automation
* Abandoned-cart recovery coupon automation

These automations help store owners reward new customers, encourage repeat purchases, send lifecycle offers, and recover missed sales.

### AI Campaign Builder Functional Beta

ZenCoupon AI Assistant includes a functional beta Campaign Builder for segmented coupon campaigns.

The current campaign flow is:

1. Enter a campaign idea.
2. Generate an AI campaign draft.
3. Select or confirm a WooCommerce customer segment.
4. Preview target customers.
5. Remove customers manually if needed.
6. Send an admin test email.
7. Start the campaign.
8. The plugin creates unique customer coupons and sends emails in background batches.

AI-generated campaign draft fields may include:

* Campaign name
* Customer segment
* Discount type and amount
* Expiry
* Usage limits
* Email subject and body
* Social post copy

Supported customer segments include:

* Win-back or inactive customers
* Category buyers
* Product buyers
* Product-tag buyers
* Registered users who never ordered
* All previous customers

Campaign delivery supports:

* Target customer preview
* Manual customer removal
* Admin test email
* Start, pause, and resume controls
* Running and completed status
* Sent count tracking
* Customer-specific unique WooCommerce coupons
* Email-restricted coupons
* WP-Cron background delivery
* 25 customers per batch
* 60-second batch gap
* Maximum 2,000 recipients per campaign

**Beta note:** AI Campaign Builder is functional, but still in beta. Please test campaigns carefully before sending large production campaigns.

### Supported AI Providers

ZenCoupon AI Assistant supports:

* Groq
* OpenAI / GPT
* Google Gemini

You can select your provider, save API keys, choose a model, enter a custom model name, and test the provider connection from the plugin settings.

### Admin Dashboard

The plugin includes an admin interface with:

* AI coupon command console
* Suggested prompts
* Polish Prompt helper
* Coupon rules preview
* Generated coupons list
* WooCommerce automation settings
* Campaign Builder beta area
* AI provider settings
* Docs & Support page
* Recent activity display

### Integrations

ZenCoupon AI Assistant includes:

* WordPress REST API endpoint
* MCP-compatible JSON-RPC style endpoint
* WooCommerce HPOS compatibility
* Support form using WordPress mail functions

== Requirements ==

* WordPress 5.0 or higher
* PHP 7.4 or higher
* WooCommerce 3.0 or higher
* Active API key from Groq, OpenAI, or Google Gemini

== External Services ==

This plugin connects to external AI APIs to process admin-entered coupon prompts and campaign draft instructions.

The plugin sends the prompt entered by the admin user, such as coupon requirements, discount rules, expiry instructions, or campaign ideas. Campaign Builder uses AI only for draft generation. Customer lists and campaign email delivery are handled inside WordPress/WooCommerce and are not sent to the AI provider by the Campaign Builder.

Store owners should avoid entering sensitive customer information into AI prompts unless they have reviewed their own privacy and compliance requirements.

= Groq AI =

Service provider: Groq, Inc.

Endpoint used:

https://api.groq.com/openai/v1/chat/completions

Terms of Service:

https://groq.com/terms-of-service/

Privacy Policy:

https://groq.com/privacy-policy/

= OpenAI =

Service provider: OpenAI, L.L.C.

Endpoint used:

https://api.openai.com/v1/responses

Terms of Use:

https://openai.com/policies/terms-of-use/

Privacy Policy:

https://openai.com/policies/privacy-policy/

= Google Gemini =

Service provider: Google LLC.

Endpoint used:

https://generativelanguage.googleapis.com/v1beta/models/

Terms of Service:

https://policies.google.com/terms

Privacy Policy:

https://policies.google.com/privacy

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/zen-coupon-ai` directory, or install the plugin through the WordPress plugins screen.
2. Activate the plugin through the Plugins screen.
3. Make sure WooCommerce is installed and active.
4. Go to WordPress Dashboard > ZenCoupon AI.
5. Select your AI provider and save your API key.
6. Test the provider connection.
7. Start creating coupons with AI.

== Frequently Asked Questions ==

= Does this plugin require WooCommerce? =

Yes. ZenCoupon AI Assistant is built for WooCommerce coupon creation, coupon management, and WooCommerce automation.

= Does this plugin create real WooCommerce coupons? =

Yes. The plugin creates and manages standard WooCommerce coupons.

= Can I choose the AI provider? =

Yes. The plugin supports Groq, OpenAI/GPT, and Google Gemini.

= Does Campaign Builder send customer data to AI providers? =

No. Campaign Builder uses AI only to generate campaign drafts. Customer selection and campaign sending are handled inside WordPress/WooCommerce.

= Is Campaign Builder just a coming soon feature? =

No. Campaign Builder is a functional beta feature with campaign draft generation, customer segmentation, test email, start/pause/resume controls, unique customer coupons, and WP-Cron batch delivery.

= Can I remove customers before launching a campaign? =

Yes. The Campaign Builder includes target customer preview and manual recipient removal.

= Are campaign coupons unique per customer? =

Yes. The Campaign Builder can generate customer-specific WooCommerce coupons and restrict coupons to customer email addresses.

= Is the plugin HPOS compatible? =

Yes. ZenCoupon AI Assistant supports WooCommerce High-Performance Order Storage.

== Screenshots ==

== Screenshots ==

1. ZenCoupon AI Assistant dashboard with coupon stats and recent activity.
2. AI coupon command console for natural-language WooCommerce coupon generation.
3. WooCommerce automation settings for lifecycle coupon emails.
4. AI Campaign Builder functional beta campaign draft screen.
5. AI provider settings for Groq, OpenAI/GPT, and Google Gemini.

== Changelog ==

= 1.1.1 =

Improvements:

* Improved AI integration for better provider handling, structured coupon output, and more reliable AI responses.
* Improved input command processing for more accurate natural-language coupon creation and editing.
* Improved coupon generation workflow for clearer rule handling and better admin review experience.
* Improved Campaign Builder messaging to clarify that it is a functional beta feature.
* Improved privacy documentation to clarify that Campaign Builder uses AI only for draft generation.
* Improved plugin positioning from a basic coupon generator to an AI coupon, automation, and campaign workflow assistant.

Added:

* Added a new Settings page for managing AI providers, model options, API keys, and plugin configuration.
* Added WooCommerce Automation feature.
* Added first-order coupon automation.
* Added welcome/account-created coupon automation.
* Added new-order coupon automation.
* Added thank-you coupon automation.
* Added order-status based coupon automation.
* Added abandoned-cart recovery coupon automation.
* Added AI Campaign Builder as a functional beta feature.
* Added natural-language campaign idea to AI campaign draft generation.
* Added campaign segmentation for win-back customers, category buyers, product buyers, product-tag buyers, registered users who never ordered, and all previous customers.
* Added campaign target customer preview and manual recipient removal.
* Added admin test email for campaigns.
* Added campaign start, pause, and resume controls.
* Added customer-specific WooCommerce coupon generation.
* Added WP-Cron based background campaign delivery.
* Added REST API integration support.
* Added MCP-compatible JSON-RPC integration support.

= 1.0.2 =

* Improved README structure and external services disclosure.
* Cleaned up REST API and coupon documentation.

= 1.0.1 =

* Fixed unique prefix constraints and refactored the plugin structure.
* Updated the text domain to match the plugin slug.
* Added missing external services disclosure for Groq, OpenAI, and Gemini.

= 1.0.0 =

* Initial release.
* Added Groq AI integration.
* Added WooCommerce HPOS support.
* Added REST API endpoint.
* Added coupon management features.

== Upgrade Notice ==

= 1.1.1 =

This release improves AI integration and input command handling, then adds WooCommerce automation, REST/MCP integration, and a functional beta AI Campaign Builder with segmentation, test email, start/pause/resume controls, unique customer coupons, and WP-Cron based batch delivery.
