Hi Gideon,
Thanks for your comment 🙂
1) I’m still considering a export feature, for now, if you’d like to export the coupons I recommend taking a look at this thread: https://wordpress.org/support/topic/export-created-coupons?replies=10#post-7963079 (it has info about exporting coupons)
2) You can modify the random coupon code via the woocommerce_coupon_code
filter. Via that you can also add a prefix if needed. Of course this does require some custom coding..
(If you’re a developer, I do take pull requests suggestions here: https://github.com/JeroenSormani/woocommerce-coupon-generator)
Have a great day!
Jeroen
Hi Jeroen,
And how the woocommerce_coupon_code filter should work?
I have added this to my functions.php to add leading zeros as a prefix but it is not working.
/*-----------------------------------------------------------------------------------*/
/* Add Leading Zeros before coupon codes generating */
/*-----------------------------------------------------------------------------------*/
function zerofill ($num, $zerofill = 8)
{
return str_pad($num, $zerofill, '0', STR_PAD_LEFT);
}
// add the filter
add_filter( 'woocommerce_coupon_code', 'filter_woocommerce_coupon_code', 10, 1 );
// define the woocommerce_coupon_code callback
function filter_woocommerce_coupon_code( $post_post_title )
{
error_log("COUPON: ".$post_post_title);
return zerofill($post_post_title);
}
Thanks,
Peter.
Hi Peter,
The code looks fine to me.
Here’s the line with the filter in the code: https://github.com/JeroenSormani/woocommerce-coupon-generator/blob/master/includes/admin/wccg-core-functions.php#L144
What does your error log show if you include the zerofill function in the logged coupon code?
(please do note that I cannot give big amounts of support to custom codes like this, I’ll do my best though)
Thanks,
Jeroen
I agree with GideonLupine.
I also would love to see the export option and prefix option.
Furthermore, I think you should also allow Description in coupon options (as in standard Woocommerce coupon management) as well. The same rationale as having prefix applies here. I could use the same description for the bulk-generated coupon codes and be able to search for them more easily later on 🙂
Best regards,
John
Hi John,
Thank you for letting me hear your voice, its duly noted 🙂
Same goes for the description, this seems like a reasonable request, so I’ll definitely check what would be needed to implement this in the next update.
Have a great weekend!
Jeroen Sormani