ZenCoupon AI Assistant is a powerful WordPress plugin that integrates with WooCommerce and AI providers to help you generate and manage coupons using simple, natural language commands.
This plugin connects to external AI APIs (Groq and Google Gemini) to process natural language commands and generate WooCommerce coupon configurations.
Groq AI (Recommended for speed)
* Model: llama3-8b-8192
* Fast inference with excellent accuracy
For Groq AI:
* Visit console.groq.com
* Create an account or sign in
* Generate an API key
The plugin provides a JSON-RPC 2.0 compatible REST endpoint at:
POST /wp-json/zencoupon/v1/mcp
`bash
curl -X POST https://yoursite.com/wp-json/zencoupon/v1/mcp \
-H “Content-Type: application/json” \
-d ‘{
“jsonrpc”: “2.0”,
“id”: 1,
“method”: “create_coupon”,
“params”: {
“code”: “SAVE20”,
“amount”: 20,
“discount_type”: “percent”,
“expiry_date”: “2026-12-31”
}
}’
Listing Coupons:
curl -X POST https://yoursite.com/wp-json/zencoupon/v1/mcp \
-H “Content-Type: application/json” \
-d ‘{
“jsonrpc”: “2.0”,
“id”: 2,
“method”: “list_coupons”
}’
Listing AI-Generated Coupons:
curl -X POST https://yoursite.com/wp-json/zencoupon/v1/mcp \
-H “Content-Type: application/json” \
-d ‘{
“jsonrpc”: “2.0”,
“id”: 3,
“method”: “list_generated_coupons”
}’
Deleting a Coupon:
curl -X POST https://yoursite.com/wp-json/zencoupon/v1/mcp \
-H “Content-Type: application/json” \
-d ‘{
“jsonrpc”: “2.0”,
“id”: 4,
“method”: “delete_coupon”,
“params”: {
“coupon_id”: 123
}
}’
Solution: Ensure you have:
Generated an API key from your chosen AI provider
Entered it in the plugin settings
Saved the settings
Solution:
The AI provider is rate-limiting your requests
The plugin will automatically retry with exponential backoff
If it persists, try switching AI providers or wait a few minutes
Consider upgrading your API plan with the provider
Solution:
The model name may be deprecated
The plugin auto-updates deprecated models to current versions
Try switching between Groq and Gemini to find a working option
Solution:
The AI model returned unexpected format
This is usually temporary – try again
If persistent, check your API key validity
Consider using a different AI provider
{
“jsonrpc”: “2.0”,
“id”: 1,
“result”: {
“coupon_id”: 123,
“code”: “SAVE20”,
“amount”: 20,
“discount_type”: “percent”,
“message”: “Coupon created successfully.”
}
}
{
“jsonrpc”: “2.0”,
“id”: 1,
“error”: {
“code”: -32600,
“message”: “Coupon code is required.”
}
}
All API keys are stored encrypted in WordPress options
REST endpoint requires manage_shop_coupons or manage_woocommerce capability
Only authenticated users with proper permissions can access the API
HTTPS is recommended for all API calls
Use Groq AI for faster responses (recommended)
Set lower temperatures (0.0-0.3) for more consistent results
Batch operations when creating multiple coupons
Monitor rate limits and adjust request frequency
Contributions are welcome! Please fork the repository and submit a pull request.
Fixed unique prefix constraints and refactored plugin structure.
Updated text domain to match plugin slug.
Added missing external services disclosure for Groq and Gemini.
Initial release
Groq AI integration
WooCommerce HPOS support
REST API endpoint
Coupon management features