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.
- Free Gift Compatibility: Specifically designed to work with Free Gift Coupons for WooCommerce plugin
- Easy-to-use Admin Interface: Generate free gift coupons through a user-friendly WordPress admin panel
- Multi-Product Support: Select single or multiple products as free gifts
- Custom Prefixes: Add custom prefixes to your coupon codes (e.g., GIFT-ABC123)
- Bulk Generation: Generate up to 100 coupons at once (security-optimized limit)
- Proper Data Structure: Creates gift_info arrays with correct product 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
- WordPress 6.5 or higher
- PHP 7.4 or higher
- WooCommerce 5.0 or higher
- Free Gift Coupons for WooCommerce plugin (required - available for purchase)
- Write access to the WordPress uploads directory
- 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
- Go to WooCommerce > Free Gift Bulk Coupons in your WordPress admin
- 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 for the coupon codes
- Click "Generate Free Gift Coupons"
- Unique Codes: Each coupon gets a unique random 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
- User capability verification (
manage_woocommercerequired) - WordPress nonce verification for form submissions
- Input sanitization and validation
- SQL injection prevention
- XSS protection
free-gift-bulk-coupon-generator/
├── free-gift-bulk-coupon-generator.php # Main plugin file
├── assets/
│ ├── css/
│ │ └── admin.css # Admin interface styles
│ └── js/
│ └── admin.js # Admin interface JavaScript
├── languages/
│ └── free-gift-bulk-coupon-generator.pot # Translation template
└── README.md # This file
The plugin provides several hooks for developers:
scg_before_coupon_generation- Fired before coupon generation startsscg_after_coupon_generation- Fired after coupon generation completesscg_coupon_generated- Fired after each individual coupon is created
scg_coupon_code_length- Filter the length of generated coupon codesscg_coupon_expiry_days- Filter the number of days until coupon expiryscg_max_coupons_per_batch- Filter the maximum number of coupons per batch
// Customize coupon expiry to 30 days
add_filter('scg_coupon_expiry_days', function($days) {
return 30;
});
// Log when coupons are generated
add_action('scg_after_coupon_generation', function($product_id, $count) {
error_log("Generated {$count} coupons for product {$product_id}");
}, 10, 2);For a detailed list of changes, please see the CHANGELOG.md file.
For support, feature requests, or bug reports, please visit the GitHub repository.
Note: This plugin is designed specifically for WooCommerce and requires WooCommerce to be installed and activated to function properly.