{"id":163135,"date":"2022-10-17T06:06:53","date_gmt":"2022-10-17T06:06:53","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/gravity-auto-coupon-generate\/"},"modified":"2026-04-13T05:53:36","modified_gmt":"2026-04-13T05:53:36","slug":"gf-auto-coupon-generate","status":"publish","type":"plugin","link":"https:\/\/sa.wordpress.org\/plugins\/gf-auto-coupon-generate\/","author":20618697,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.2.0","stable_tag":"1.2.0","tested":"6.9.4","requires":"5.2.0","requires_php":"7.0","requires_plugins":null,"header_name":"Auto Coupon Generate for Gravity Forms","header_author":"Krishna Gajera","header_description":"Allow users to create their own custom Coupon code for the Gravity forms","assets_banners_color":"b7b3b0","last_updated":"2026-04-13 05:53:36","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"","header_author_uri":"https:\/\/profiles.wordpress.org\/krishnagajera\/","rating":0,"author_block_rating":0,"active_installs":10,"downloads":1472,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.0.0":{"tag":"1.0.0","author":"krishnagajera","date":"2022-10-17 06:06:47"},"1.0.1":{"tag":"1.0.1","author":"krishnagajera","date":"2022-10-17 06:15:52"},"1.0.2":{"tag":"1.0.2","author":"krishnagajera","date":"2022-11-03 12:52:29"},"1.1.0":{"tag":"1.1.0","author":"krishnagajera","date":"2026-04-10 11:01:23"},"1.2.0":{"tag":"1.2.0","author":"krishnagajera","date":"2026-04-13 05:53:36"}},"upgrade_notice":[],"ratings":[],"assets_icons":{"icon-256x256.png":{"filename":"icon-256x256.png","revision":2799797,"resolution":"256x256","location":"assets","locale":""}},"assets_banners":{"banner-772x250.png":{"filename":"banner-772x250.png","revision":2799797,"resolution":"772x250","location":"assets","locale":""}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.0","1.0.1","1.0.2","1.1.0","1.2.0"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":2799807,"resolution":"1","location":"assets","locale":""},"screenshot-2.png":{"filename":"screenshot-2.png","revision":2799807,"resolution":"2","location":"assets","locale":""},"screenshot-3.png":{"filename":"screenshot-3.png","revision":2799807,"resolution":"3","location":"assets","locale":""},"screenshot-4.png":{"filename":"screenshot-4.png","revision":2799807,"resolution":"4","location":"assets","locale":""},"screenshot-5.png":{"filename":"screenshot-5.png","revision":2799807,"resolution":"5","location":"assets","locale":""}},"screenshots":{"1":"Settings page - Coupon Generate Form Settings section.","2":"Settings page - Email Notification Settings section.","3":"Coupon Log admin page showing generated coupon history.","4":"Example Gravity Form with a hidden coupon code field pre-populated on load.","5":"Generated coupon visible in the Gravity Forms Coupons Add-On list."},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[260064,326,592,214681,1655],"plugin_category":[45],"plugin_contributors":[214682],"plugin_business_model":[],"class_list":["post-163135","plugin","type-plugin","status-publish","hentry","plugin_tags-auto-generate-coupon","plugin_tags-coupon","plugin_tags-coupon-code","plugin_tags-generate-coupon","plugin_tags-gravity-forms","plugin_category-ecommerce","plugin_contributors-krishnagajera","plugin_committers-krishnagajera"],"banners":{"banner":"https:\/\/ps.w.org\/gf-auto-coupon-generate\/assets\/banner-772x250.png?rev=2799797","banner_2x":false,"banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/gf-auto-coupon-generate\/assets\/icon-256x256.png?rev=2799797","icon_2x":"https:\/\/ps.w.org\/gf-auto-coupon-generate\/assets\/icon-256x256.png?rev=2799797","generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/gf-auto-coupon-generate\/assets\/screenshot-1.png?rev=2799807","caption":"Settings page - Coupon Generate Form Settings section."},{"src":"https:\/\/ps.w.org\/gf-auto-coupon-generate\/assets\/screenshot-2.png?rev=2799807","caption":"Settings page - Email Notification Settings section."},{"src":"https:\/\/ps.w.org\/gf-auto-coupon-generate\/assets\/screenshot-3.png?rev=2799807","caption":"Coupon Log admin page showing generated coupon history."},{"src":"https:\/\/ps.w.org\/gf-auto-coupon-generate\/assets\/screenshot-4.png?rev=2799807","caption":"Example Gravity Form with a hidden coupon code field pre-populated on load."},{"src":"https:\/\/ps.w.org\/gf-auto-coupon-generate\/assets\/screenshot-5.png?rev=2799807","caption":"Generated coupon visible in the Gravity Forms Coupons Add-On list."}],"raw_content":"<!--section=description-->\n<p><strong>Auto Coupon Generate for Gravity Forms<\/strong> 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.<\/p>\n\n<p>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.<\/p>\n\n<p><strong>Key Features<\/strong><\/p>\n\n<ul>\n<li>Automatically generates a unique, random coupon code on every form submission.<\/li>\n<li>Coupon codes are saved directly to the Gravity Forms Coupons Add-On - no extra steps needed.<\/li>\n<li>Configurable code length, character set, and optional prefix so codes match your brand.<\/li>\n<li>Supports both flat (fixed amount) and percentage discount types.<\/li>\n<li>Set a minimum order value that must be met before the coupon applies.<\/li>\n<li>Control how many times each coupon can be used in total.<\/li>\n<li>Optional start date and expiration date for time-limited promotions.<\/li>\n<li>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 <code>{coupon_code}<\/code> placeholder anywhere in the message body.<\/li>\n<li>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.<\/li>\n<li>Shipping is excluded from discount calculations by default - the discount applies to the order subtotal only.<\/li>\n<li>Secure: uses <code>random_int()<\/code> for cryptographically safe code generation, proper nonce verification, and capability checks on all admin pages.<\/li>\n<\/ul>\n\n<p><strong>Requirements<\/strong><\/p>\n\n<ul>\n<li>WordPress 5.2 or higher<\/li>\n<li>PHP 7.0 or higher<\/li>\n<li><a href=\"https:\/\/www.gravityforms.com\/\">Gravity Forms<\/a> (any recent version)<\/li>\n<li><a href=\"https:\/\/www.gravityforms.com\/add-ons\/coupons\/\">Gravity Forms Coupons Add-On<\/a> (must be installed and active)<\/li>\n<\/ul>\n\n<p>The plugin will check for these dependencies on activation and will not activate if either Gravity Forms or the Coupons Add-On is missing.<\/p>\n\n<h3>Configuration<\/h3>\n\n<p>After activating the plugin, go to <strong>Generate Coupon Setting<\/strong> in the WordPress admin menu. The settings page is divided into three sections.<\/p>\n\n<h4>Coupon Generate Form Settings<\/h4>\n\n<p>These settings control how coupon codes are generated and what discount they carry.<\/p>\n\n<ul>\n<li><strong>Form ID<\/strong> - 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.<\/li>\n<li><strong>Coupon Field ID<\/strong> - The ID of the field inside that form where the generated coupon code will be pre-populated (using the <code>gform_field_value_uuid<\/code> filter). This is typically a hidden field.<\/li>\n<li><strong>Coupon Length<\/strong> - The number of random characters in the coupon code (not counting any prefix). For example, a length of 8 with the prefix <code>SALE-<\/code> would produce codes like <code>SALE-A3BX92KQ<\/code>.<\/li>\n<li><strong>Coupon Code Prefix<\/strong> - Optional text to prepend to every generated code (e.g. <code>SUMMER-<\/code>). Leave blank for no prefix.<\/li>\n<li><strong>Coupon Code Characters<\/strong> - The pool of characters used when generating the random part of the code. The default is <code>1234567890QWERTYUIOPASDFGHJKLZXCVBNM<\/code>. You can narrow this down - for example, removing easily confused characters like <code>0<\/code>, <code>O<\/code>, <code>1<\/code>, and <code>I<\/code>.<\/li>\n<li><strong>Discount Type<\/strong> - Choose <strong>Percentage<\/strong> to deduct a percentage of the order total, or <strong>Flat<\/strong> to deduct a fixed amount.<\/li>\n<li><strong>Discount Amount<\/strong> - 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. <code>10<\/code> for $10 off).<\/li>\n<li><strong>Max Usage<\/strong> - The maximum number of times the generated coupon can be used across all customers. Enter <code>1<\/code> to make it single-use.<\/li>\n<li><strong>Minimum Price<\/strong> - The minimum order subtotal (excluding shipping) a customer must reach before the coupon becomes valid. Leave blank for no minimum.<\/li>\n<li><strong>Start Date<\/strong> - The date from which the coupon becomes valid, in <code>MM\/DD\/YYYY<\/code> format. Leave blank to make it valid immediately.<\/li>\n<li><strong>Expiration Date<\/strong> - The date on which the coupon expires, in <code>MM\/DD\/YYYY<\/code> format. Leave blank for no expiry.<\/li>\n<\/ul>\n\n<h4>Coupon Usage Form Settings<\/h4>\n\n<ul>\n<li><strong>Form ID<\/strong> - 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.<\/li>\n<\/ul>\n\n<h4>Email Notification Settings<\/h4>\n\n<p>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.<\/p>\n\n<ul>\n<li><strong>Email Field ID<\/strong> - 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.<\/li>\n<li><strong>Email Subject<\/strong> - The subject line of the notification email. Default: <code>Your Coupon Code<\/code>.<\/li>\n<li><strong>Email Body<\/strong> - The body of the notification email. Use the placeholder <code>{coupon_code}<\/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.<\/li>\n<li><strong>Enable Email<\/strong> - Check this box to activate automatic email sending. When unchecked, no email is sent regardless of the other email settings.<\/li>\n<\/ul>\n\n<p>The email is sent using WordPress's built-in <code>wp_mail()<\/code> function. Delivery depends on your server's mail configuration or any SMTP plugin you have installed.<\/p>\n\n<h3>Coupon Log<\/h3>\n\n<p>Go to <strong>Generate Coupon Setting &gt; Coupon Log<\/strong> 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.<\/p>\n\n<!--section=installation-->\n<h4>From within WordPress<\/h4>\n\n<ol>\n<li>Go to <strong>Plugins &gt; Add New<\/strong> in your WordPress admin.<\/li>\n<li>Search for <strong>Auto Coupon Generate for Gravity Forms<\/strong>.<\/li>\n<li>Click <strong>Install Now<\/strong>, then <strong>Activate<\/strong>.<\/li>\n<li>Go to <strong>Generate Coupon Setting<\/strong> in the left-hand admin menu.<\/li>\n<li>Fill in the required fields and click <strong>Save Settings<\/strong>.<\/li>\n<\/ol>\n\n<h4>Manually<\/h4>\n\n<ol>\n<li>Download the plugin zip file.<\/li>\n<li>Extract it and upload the <code>gf-auto-coupon-generate<\/code> folder to <code>\/wp-content\/plugins\/<\/code>.<\/li>\n<li>Go to <strong>Plugins<\/strong> in your WordPress admin and activate <strong>Auto Coupon Generate for Gravity Forms<\/strong>.<\/li>\n<li>Go to <strong>Generate Coupon Setting<\/strong> in the left-hand admin menu.<\/li>\n<li>Fill in the required fields and click <strong>Save Settings<\/strong>.<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt id=\"does%20this%20plugin%20work%20without%20gravity%20forms%3F\"><h3>Does this plugin work without Gravity Forms?<\/h3><\/dt>\n<dd><p>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.<\/p><\/dd>\n<dt id=\"where%20do%20i%20find%20my%20form%20id%20and%20field%20id%3F\"><h3>Where do I find my Form ID and Field ID?<\/h3><\/dt>\n<dd><p>To find a Form ID, go to <strong>Forms<\/strong> 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.<\/p><\/dd>\n<dt id=\"can%20i%20use%20this%20for%20woocommerce%20coupons%3F\"><h3>Can I use this for WooCommerce coupons?<\/h3><\/dt>\n<dd><p>Not yet - the current version works exclusively with the Gravity Forms Coupons Add-On. WooCommerce coupon support is planned for a future release.<\/p><\/dd>\n<dt id=\"is%20shipping%20included%20in%20the%20discount%20calculation%3F\"><h3>Is shipping included in the discount calculation?<\/h3><\/dt>\n<dd><p>No. Discount is applied to the order subtotal only. Shipping costs are excluded from the calculation by default.<\/p><\/dd>\n<dt id=\"can%20i%20customise%20the%20email%20that%20is%20sent%20to%20the%20user%3F\"><h3>Can I customise the email that is sent to the user?<\/h3><\/dt>\n<dd><p>Yes. You can set any subject line and any body text you like in the Email Notification Settings section. Use <code>{coupon_code}<\/code> in the body as a placeholder and it will be replaced with the actual coupon code before the email is sent.<\/p><\/dd>\n<dt id=\"what%20happens%20if%20the%20plugin%20cannot%20generate%20a%20unique%20code%3F\"><h3>What happens if the plugin cannot generate a unique code?<\/h3><\/dt>\n<dd><p>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.<\/p><\/dd>\n<dt id=\"will%20my%20settings%20be%20deleted%20if%20i%20uninstall%20the%20plugin%3F\"><h3>Will my settings be deleted if I uninstall the plugin?<\/h3><\/dt>\n<dd><p>Yes. All plugin options are cleaned up from the WordPress database when the plugin is uninstalled via the <strong>Plugins<\/strong> screen.<\/p><\/dd>\n<dt id=\"the%20coupon%20email%20is%20not%20being%20delivered%20-%20what%20should%20i%20check%3F\"><h3>The coupon email is not being delivered - what should I check?<\/h3><\/dt>\n<dd><p>The plugin uses <code>wp_mail()<\/code> 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.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.2.0<\/h4>\n\n<ul>\n<li>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 <code>{coupon_code}<\/code> in the body as a placeholder.<\/li>\n<li>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.<\/li>\n<\/ul>\n\n<h4>1.1.0<\/h4>\n\n<ul>\n<li>Security: Fixed inverted nonce validation in the admin AJAX handler.<\/li>\n<li>Security: Assigned the <code>wp_unslash()<\/code> result before reading posted values.<\/li>\n<li>Security: Replaced <code>rand()<\/code> with <code>random_int()<\/code> for cryptographically safe coupon code generation.<\/li>\n<li>Security: Changed admin page capability from <code>administrator<\/code> to <code>manage_options<\/code>.<\/li>\n<li>Fix: Added a max-attempt safeguard (100 attempts) to coupon code generation with graceful failure if a unique code cannot be produced.<\/li>\n<li>Fix: Replaced deprecated <code>rg_lead_detail<\/code> table references with the modern <code>gf_entry_meta<\/code> table.<\/li>\n<li>Fix: Added admin settings for start date, expiration date, code prefix, and code character set.<\/li>\n<li>Fix: Made the minimum price field optional in JavaScript validation.<\/li>\n<li>Fix: Corrected output escaping in the admin settings UI for all attribute contexts.<\/li>\n<li>Fix: Added plugin activation dependency checks - plugin will not activate without Gravity Forms and the Coupons Add-On.<\/li>\n<li>Fix: Expanded uninstall.php to remove all plugin options on deletion.<\/li>\n<\/ul>\n\n<h4>1.0.2<\/h4>\n\n<ul>\n<li>Fix: Assets load issue.<\/li>\n<\/ul>\n\n<h4>1.0.1<\/h4>\n\n<ul>\n<li>Readme update.<\/li>\n<\/ul>\n\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>Initial release.<\/li>\n<\/ul>","raw_excerpt":"Generate unique discount coupon codes automatically when a Gravity Form is submitted. Optionally email the code to the user.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/163135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=163135"}],"author":[{"embeddable":true,"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/krishnagajera"}],"wp:attachment":[{"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=163135"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=163135"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=163135"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=163135"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=163135"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=163135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}