Title: Auto Coupon Generate for Gravity Forms
Author: Krishna Gajera
Published: <strong>17 de octubre de 2022</strong>
Last modified: 13 de abril de 2026

---

Buscar plugins

![](https://ps.w.org/gf-auto-coupon-generate/assets/banner-772x250.png?rev=2799797)

![](https://ps.w.org/gf-auto-coupon-generate/assets/icon-256x256.png?rev=2799797)

# Auto Coupon Generate for Gravity Forms

 Por [Krishna Gajera](https://profiles.wordpress.org/krishnagajera/)

[Descargar](https://downloads.wordpress.org/plugin/gf-auto-coupon-generate.1.2.0.zip)

 * [Detalles](https://es.wordpress.org/plugins/gf-auto-coupon-generate/#description)
 * [Valoraciones](https://es.wordpress.org/plugins/gf-auto-coupon-generate/#reviews)
 *  [Instalación](https://es.wordpress.org/plugins/gf-auto-coupon-generate/#installation)
 * [Desarrollo](https://es.wordpress.org/plugins/gf-auto-coupon-generate/#developers)

 [Soporte](https://wordpress.org/support/plugin/gf-auto-coupon-generate/)

## Descripción

**Auto Coupon Generate for Gravity Forms** lets you automatically create a unique
discount coupon code every time a visitor submits a Gravity Form. The generated 
code is saved directly as a Gravity Forms coupon and can optionally be emailed to
the user straight away – no manual work required.

A common use case is a two-step flow: a user fills out a registration or survey 
form, receives a unique coupon code by email, and then uses it on a subsequent order
form to claim their discount.

**Key Features**

 * Automatically generates a unique, random coupon code on every form submission.
 * Coupon codes are saved directly to the Gravity Forms Coupons Add-On – no extra
   steps needed.
 * Configurable code length, character set, and optional prefix so codes match your
   brand.
 * Supports both flat (fixed amount) and percentage discount types.
 * Set a minimum order value that must be met before the coupon applies.
 * Control how many times each coupon can be used in total.
 * Optional start date and expiration date for time-limited promotions.
 * Built-in email notification – send the generated coupon code to the user’s email
   address automatically after submission. The email subject and body are fully 
   customisable, and you can use the `{coupon_code}` placeholder anywhere in the
   message body.
 * Coupon Log page in the WordPress admin showing a full history of every coupon
   generated, including the code, the form it came from, and the date it was created.
 * Shipping is excluded from discount calculations by default – the discount applies
   to the order subtotal only.
 * Secure: uses `random_int()` for cryptographically safe code generation, proper
   nonce verification, and capability checks on all admin pages.

**Requirements**

 * WordPress 5.2 or higher
 * PHP 7.0 or higher
 * [Gravity Forms](https://www.gravityforms.com/) (any recent version)
 * [Gravity Forms Coupons Add-On](https://www.gravityforms.com/add-ons/coupons/)(
   must be installed and active)

The plugin will check for these dependencies on activation and will not activate
if either Gravity Forms or the Coupons Add-On is missing.

### Configuration

After activating the plugin, go to **Generate Coupon Setting** in the WordPress 
admin menu. The settings page is divided into three sections.

#### Coupon Generate Form Settings

These settings control how coupon codes are generated and what discount they carry.

 * **Form ID** – The ID of the Gravity Form that will trigger coupon generation 
   on submission. To find your form ID, go to Forms in your WordPress admin; the
   ID is shown in the form list.
 * **Coupon Field ID** – The ID of the field inside that form where the generated
   coupon code will be pre-populated (using the `gform_field_value_uuid` filter).
   This is typically a hidden field.
 * **Coupon Length** – The number of random characters in the coupon code (not counting
   any prefix). For example, a length of 8 with the prefix `SALE-` would produce
   codes like `SALE-A3BX92KQ`.
 * **Coupon Code Prefix** – Optional text to prepend to every generated code (e.
   g. `SUMMER-`). Leave blank for no prefix.
 * **Coupon Code Characters** – The pool of characters used when generating the 
   random part of the code. The default is `1234567890QWERTYUIOPASDFGHJKLZXCVBNM`.
   You can narrow this down – for example, removing easily confused characters like`
   0`, `O`, `1`, and `I`.
 * **Discount Type** – Choose **Percentage** to deduct a percentage of the order
   total, or **Flat** to deduct a fixed amount.
 * **Discount Amount** – The value of the discount. If Discount Type is Percentage,
   enter a number between 1 and 100. If Discount Type is Flat, enter the currency
   amount (e.g. `10` for $10 off).
 * **Max Usage** – The maximum number of times the generated coupon can be used 
   across all customers. Enter `1` to make it single-use.
 * **Minimum Price** – The minimum order subtotal (excluding shipping) a customer
   must reach before the coupon becomes valid. Leave blank for no minimum.
 * **Start Date** – The date from which the coupon becomes valid, in `MM/DD/YYYY`
   format. Leave blank to make it valid immediately.
 * **Expiration Date** – The date on which the coupon expires, in `MM/DD/YYYY` format.
   Leave blank for no expiry.

#### Coupon Usage Form Settings

 * **Form ID** – The ID of the Gravity Form where customers will enter and apply
   their coupon code (your checkout or order form). The generated coupon will be
   scoped to this form inside the Gravity Forms Coupons Add-On.

#### Email Notification Settings

These settings are all optional. If you do not enable email notifications, coupons
are still generated and saved – users just will not receive an automatic email.

 * **Email Field ID** – The ID of the field in the coupon-generate form that holds
   the user’s email address. The plugin will read the submitted value from this 
   field and send the notification to that address.
 * **Email Subject** – The subject line of the notification email. Default: `Your
   Coupon Code`.
 * **Email Body** – The body of the notification email. Use the placeholder `{coupon_code}`
   anywhere in the text and it will be replaced with the actual generated code before
   sending. Default message is provided but you can customise it freely.
 * **Enable Email** – Check this box to activate automatic email sending. When unchecked,
   no email is sent regardless of the other email settings.

The email is sent using WordPress’s built-in `wp_mail()` function. Delivery depends
on your server’s mail configuration or any SMTP plugin you have installed.

### Coupon Log

Go to **Generate Coupon Setting > Coupon Log** in the WordPress admin to see a table
of every coupon that has been generated by the plugin. The table shows the coupon
code, the form it was generated from, and the date and time it was created. The 
log displays the 100 most recent entries in reverse chronological order.

## Capturas

[⌊Settings page - Coupon Generate Form Settings section.⌉⌊Settings page - Coupon
Generate Form Settings section.⌉[

Settings page – Coupon Generate Form Settings section.

[⌊Settings page - Email Notification Settings section.⌉⌊Settings page - Email Notification
Settings section.⌉[

Settings page – Email Notification Settings section.

[⌊Coupon Log admin page showing generated coupon history.⌉⌊Coupon Log admin page
showing generated coupon history.⌉[

Coupon Log admin page showing generated coupon history.

[⌊Example Gravity Form with a hidden coupon code field pre-populated on load.⌉⌊Example
Gravity Form with a hidden coupon code field pre-populated on load.⌉[

Example Gravity Form with a hidden coupon code field pre-populated on load.

[⌊Generated coupon visible in the Gravity Forms Coupons Add-On list.⌉⌊Generated 
coupon visible in the Gravity Forms Coupons Add-On list.⌉[

Generated coupon visible in the Gravity Forms Coupons Add-On list.

## Instalación

#### From within WordPress

 1. Go to **Plugins > Add New** in your WordPress admin.
 2. Search for **Auto Coupon Generate for Gravity Forms**.
 3. Click **Install Now**, then **Activate**.
 4. Go to **Generate Coupon Setting** in the left-hand admin menu.
 5. Fill in the required fields and click **Save Settings**.

#### Manually

 1. Download the plugin zip file.
 2. Extract it and upload the `gf-auto-coupon-generate` folder to `/wp-content/plugins/`.
 3. Go to **Plugins** in your WordPress admin and activate **Auto Coupon Generate for
    Gravity Forms**.
 4. Go to **Generate Coupon Setting** in the left-hand admin menu.
 5. Fill in the required fields and click **Save Settings**.

## FAQ

### Does this plugin work without Gravity Forms?

No. Both Gravity Forms and the Gravity Forms Coupons Add-On must be installed and
active. The plugin checks for these on activation and will refuse to activate if
they are missing.

### Where do I find my Form ID and Field ID?

To find a Form ID, go to **Forms** in your WordPress admin. The ID appears in the
form list next to each form name. To find a Field ID, open the form in the form 
editor, click on the field you want, and look in the field settings panel on the
right – the field ID is displayed there.

### Can I use this for WooCommerce coupons?

Not yet – the current version works exclusively with the Gravity Forms Coupons Add-
On. WooCommerce coupon support is planned for a future release.

### Is shipping included in the discount calculation?

No. Discount is applied to the order subtotal only. Shipping costs are excluded 
from the calculation by default.

### Can I customise the email that is sent to the user?

Yes. You can set any subject line and any body text you like in the Email Notification
Settings section. Use `{coupon_code}` in the body as a placeholder and it will be
replaced with the actual coupon code before the email is sent.

### What happens if the plugin cannot generate a unique code?

The code generator makes up to 100 attempts to produce a code that has not been 
used before. If all 100 attempts fail (extremely unlikely in normal use), the generation
is aborted gracefully and no coupon is saved.

### Will my settings be deleted if I uninstall the plugin?

Yes. All plugin options are cleaned up from the WordPress database when the plugin
is uninstalled via the **Plugins** screen.

### The coupon email is not being delivered – what should I check?

The plugin uses `wp_mail()` which relies on your server’s mail configuration. If
emails are not arriving, install an SMTP plugin such as WP Mail SMTP and connect
it to a mail provider like SendGrid, Mailgun, or Gmail. Also check your spam folder.

## Reseñas

No hay valoraciones para este plugin.

## Colaboradores y desarrolladores

«Auto Coupon Generate for Gravity Forms» es un software de código abierto. Las siguientes
personas han colaborado con este plugin.

Colaboradores

 *   [ Krishna Gajera ](https://profiles.wordpress.org/krishnagajera/)

[Traduce «Auto Coupon Generate for Gravity Forms» a tu idioma.](https://translate.wordpress.org/projects/wp-plugins/gf-auto-coupon-generate)

### ¿Interesado en el desarrollo?

[Revisa el código](https://plugins.trac.wordpress.org/browser/gf-auto-coupon-generate/),
echa un vistazo al [repositorio SVN](https://plugins.svn.wordpress.org/gf-auto-coupon-generate/)
o suscríbete al [registro de desarrollo](https://plugins.trac.wordpress.org/log/gf-auto-coupon-generate/)
por [RSS](https://plugins.trac.wordpress.org/log/gf-auto-coupon-generate/?limit=100&mode=stop_on_copy&format=rss).

## Registro de cambios

#### 1.2.0

 * Feature: Email notification – automatically send the generated coupon code to
   the user’s email address after form submission. Subject, body, and the field 
   used for the email address are all configurable. Use `{coupon_code}` in the body
   as a placeholder.
 * Feature: Coupon Log – new admin sub-menu page under Generate Coupon Setting showing
   a full history of all coupons generated by the plugin, including coupon code,
   form ID, and date generated.

#### 1.1.0

 * Security: Fixed inverted nonce validation in the admin AJAX handler.
 * Security: Assigned the `wp_unslash()` result before reading posted values.
 * Security: Replaced `rand()` with `random_int()` for cryptographically safe coupon
   code generation.
 * Security: Changed admin page capability from `administrator` to `manage_options`.
 * Fix: Added a max-attempt safeguard (100 attempts) to coupon code generation with
   graceful failure if a unique code cannot be produced.
 * Fix: Replaced deprecated `rg_lead_detail` table references with the modern `gf_entry_meta`
   table.
 * Fix: Added admin settings for start date, expiration date, code prefix, and code
   character set.
 * Fix: Made the minimum price field optional in JavaScript validation.
 * Fix: Corrected output escaping in the admin settings UI for all attribute contexts.
 * Fix: Added plugin activation dependency checks – plugin will not activate without
   Gravity Forms and the Coupons Add-On.
 * Fix: Expanded uninstall.php to remove all plugin options on deletion.

#### 1.0.2

 * Fix: Assets load issue.

#### 1.0.1

 * Readme update.

#### 1.0.0

 * Initial release.

## Meta

 *  Versión **1.2.0**
 *  Última actualización **hace 6 meses**
 *  Instalaciones activas **10+**
 *  Versión de WordPress ** 5.2.0 o superior **
 *  Probado hasta **6.9.10**
 *  Versión de PHP ** 7.0 o superior **
 *  Idioma
 * [English (US)](https://wordpress.org/plugins/gf-auto-coupon-generate/)
 * Etiquetas:
 * [coupon](https://es.wordpress.org/plugins/tags/coupon/)[coupon code](https://es.wordpress.org/plugins/tags/coupon-code/)
   [gravity forms](https://es.wordpress.org/plugins/tags/gravity-forms/)
 *  [Vista avanzada](https://es.wordpress.org/plugins/gf-auto-coupon-generate/advanced/)

## Valoraciones

Aún no se han enviado valoraciones.

[Tu valoración](https://wordpress.org/support/plugin/gf-auto-coupon-generate/reviews/#new-post)

[Ver todas las reseñas](https://wordpress.org/support/plugin/gf-auto-coupon-generate/reviews/)

## Colaboradores

 *   [ Krishna Gajera ](https://profiles.wordpress.org/krishnagajera/)

## Soporte

¿Tienes algo que decir? ¿Necesitas ayuda?

 [Ver el foro de soporte](https://wordpress.org/support/plugin/gf-auto-coupon-generate/)