Skip to content

EngineScript/wc-free-gift-coupons-bulk-coupons-generator

WC Free Gift Coupons Bulk Coupon Generator

Codacy Badge License WordPress Compatible PHP Compatible

Current Version

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 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

Requirements

  • 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

Installation

  1. Download the plugin files
  2. Upload the free-gift-bulk-coupon-generator folder to your /wp-content/plugins/ directory
  3. Activate the plugin through the 'Plugins' menu in WordPress
  4. Make sure you have the Free Gift Coupons for WooCommerce plugin installed and activated
  5. Navigate to WooCommerce > Free Gift Bulk Coupons to start using the plugin

Usage

  1. Go to WooCommerce > Free Gift Bulk Coupons in your WordPress admin
  2. Select one or more products you want to give as free gifts
  3. Enter the number of coupons to generate (1-100)
  4. Optionally add a custom prefix for the coupon codes
  5. Click "Generate Free Gift Coupons"

Generated Coupon Features

  • 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

Security Features

  • User capability verification (manage_woocommerce required)
  • 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    # 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

Hooks and Filters

The plugin provides several hooks for developers:

Actions

  • scg_before_coupon_generation - Fired before coupon generation starts
  • scg_after_coupon_generation - Fired after coupon generation completes
  • scg_coupon_generated - Fired after each individual coupon is created

Filters

  • scg_coupon_code_length - Filter the length of generated coupon codes
  • scg_coupon_expiry_days - Filter the number of days until coupon expiry
  • scg_max_coupons_per_batch - Filter the maximum number of coupons per batch

Code Example

// 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);

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 is designed specifically for WooCommerce and requires WooCommerce to be installed and activated to function properly.

About

Generate bulk coupon codes for use with WooCommerce Free Gift Coupons plugin

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •