Free Gift Coupons Bulk Coupon Generator
Generate bulk coupon codes for use with WooCommerce Free Gift Coupons plugin
by EngineScript · github.com/enginescript/free-gift-coupons-bulk-coupons-generator · website
Install
The author publishes release zips, so WP-CLI can install straight from GitHub:
wp plugin install https://github.com/enginescript/free-gift-coupons-bulk-coupons-generator/releases/download/v1.6.0/free-gift-bulk-coupon-generator-1.6.0.zipReadme
Free Gift Coupons Bulk Coupon Generator
Current Version
A WordPress plugin for generating bulk free gift coupons that work specifically with the Free Gift Coupons for WooCommerce plugin. Creates coupons with the proper data structure required for free gift functionality.
Important: This plugin requires the Free Gift Coupons for WooCommerce plugin to function properly. The Free Gift Coupons plugin can be purchased from the official WooCommerce marketplace.
Features
- Free Gift Compatibility: Specifically designed to work with the Free Gift Coupons for WooCommerce plugin
- Easy-to-use Admin Interface: Generate free gift coupons through a user-friendly WordPress admin panel
- AJAX Product Search: WooCommerce Select2-powered product search - scales to any catalog size
- AJAX Batch Generation: Generates coupons in batches of 10 with a real-time progress bar to reduce timeout risk
- Multi-Product Support: Select single or multiple products as free gifts
- Custom Prefixes: Add custom prefixes to your coupon codes (e.g., GIFTABC123)
- Generated Code Export: Displays generated codes one per line and downloads them as a
.txtfile - Bulk Generation: Generate up to 100 coupons per run with server-side enforcement
- Proper Data Structure: Creates
$gift_infoarrays with the correct product and variation ID mapping - Security First: Follows WordPress and OWASP security best practices with comprehensive protection
- Responsive Design: Works perfectly on desktop and mobile devices
- Internationalization Ready: Prepared for translation into multiple languages
- Developer Friendly: Extensive hooks and filters for customization
Requirements
- WordPress 6.8 or higher
- PHP 8.2 or higher
- WooCommerce 5.0 or higher
- Free Gift Coupons for WooCommerce plugin (required - available for purchase)
- Write access to the WordPress uploads directory
Installation
- Download the plugin files
- Upload the
free-gift-bulk-coupon-generatorfolder to your/wp-content/plugins/directory - Activate the plugin through the 'Plugins' menu in WordPress
- Make sure you have the Free Gift Coupons for WooCommerce plugin installed and activated
- Navigate to WooCommerce > Free Gift Bulk Coupons to start using the plugin
Usage
- Go to WooCommerce > Free Gift Bulk Coupons in your WordPress admin
- Search and select one or more products you want to give as free gifts
- Enter the number of coupons to generate (1-100)
- Optionally add a custom prefix and random code length
- Click "Generate Free Gift Coupons" and watch the progress bar
- Copy the generated codes from the page or download them as a
.txtfile
Generated Coupon Features
- Unique Codes: Each coupon gets a unique alphanumeric code
- One-time Use: Each coupon can only be used once
- Individual Use: Coupons cannot be combined with other coupons
- Auto-expiration: Coupons expire after 1 year
- Detailed Descriptions: Each coupon includes information about the associated product
Security Features
- User capability verification (
manage_woocommercerequired) - WordPress nonce verification for form submissions
- Input sanitization and validation
- SQL injection prevention
- XSS protection
Developer Information
File Structure
free-gift-bulk-coupon-generator/
|-- free-gift-bulk-coupon-generator.php # Plugin entry point
|-- includes/
| |-- class-fgcbg-admin-assets.php # Admin asset loading and script data
| |-- class-fgcbg-admin-page.php # Admin page rendering
| |-- class-fgcbg-ajax-handler.php # AJAX request handling
| |-- class-fgcbg-coupon-generator.php # Coupon generation logic
| |-- class-fgcbg-dependencies.php # Dependency checks
| `-- class-fgcbg-plugin.php # Main plugin orchestration
|-- assets/
| |-- css/
| | `-- admin.css # Admin interface styles
| `-- js/
| `-- admin.js # Admin interface JavaScript
|-- languages/
| `-- free-gift-bulk-coupon-generator.pot
`-- README.md
Hooks and Filters
The plugin provides several hooks for developers:
Actions
fgcbg_before_coupon_generation- Fired before coupon generation startsfgcbg_after_coupon_generation- Fired after coupon generation completesfgcbg_coupon_generated- Fired after each individual coupon is created
Filters
fgcbg_coupon_code_length- Filter the random portion length of generated coupon codes (default: 8, bounds: 8-24)fgcbg_coupon_expiry_days- Filter the number of days until coupon expiry (default: 365)fgcbg_max_coupons_per_batch- Filter the maximum number of coupons per batch (default: 100)
Code Example
/**
* Customize coupon expiry to 30 days.
*
* @param int $days Default expiry days.
* @return int
*/
function my_custom_coupon_expiry( $days ) {
return 30;
}
add_filter( 'fgcbg_coupon_expiry_days', 'my_custom_coupon_expiry' );
/**
* Log when coupons are generated.
*
* @param array $product_ids Product IDs.
* @param int $count Number generated.
* @return void
*/
function my_log_coupon_generation( $product_ids, $count ) {
wc_get_logger()->info( "Generated {$count} coupons.", array( 'source' => 'my-plugin' ) );
}
add_action( 'fgcbg_after_coupon_generation', 'my_log_coupon_generation', 10, 2 );
Changelog
For a detailed list of changes, please see the CHANGELOG.md file.
Support
For support, feature requests, or bug reports, please visit the GitHub repository.
Note: This plugin requires WooCommerce and Free Gift Coupons for WooCommerce to be installed and activated.
Read the full README on GitHub →
Releases
| Tag | Published | Asset | Downloads |
|---|---|---|---|
| v1.6.0 | May 17, 2026 | free-gift-bulk-coupon-generator-1.6.0.zip | 1 |
| v1.5.1 | Feb 24, 2026 | free-gift-bulk-coupon-generator-1.5.1.zip | 2 |
| v1.5.0 | Aug 23, 2025 | free-gift-bulk-coupon-generator-1.5.0.zip | 0 |
| v1.4.0 | Aug 2, 2025 | free-gift-bulk-coupon-generator-1.4.0.zip | 0 |
| v1.3.0 | Aug 2, 2025 | free-gift-bulk-coupon-generator-1.3.0.zip | 0 |
| v1.2.0 | Jul 11, 2025 | free-gift-bulk-coupon-generator-1.2.0.zip | 5 |
| v1.1.0 | Jun 26, 2025 | free-gift-bulk-coupon-generator-1.1.0.zip | 0 |
| v1.0.0 | Jun 20, 2025 | free-gift-bulk-coupon-generator-1.0.0.zip | 5 |