• A way to export generated coupon codes is a key feature.

    A way to tell coupons apart is another key feature.

    If you could assign a 4 character Prefix, it would help to identify what a group of 100 coupons are for.

    For example If I set a prefix to “P1AB-“, I would know that all 100 of those coupons are for T-shirts.

    It would also make searching for a group of coupons easier.

    Also, I could request to export or print to screen all coupons that begin with “P1AB-“

    Being able to group coupons into sets and to be able to print them or export them is key.

    https://wordpress.org/plugins/coupon-generator-for-woocommerce/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jeroen Sormani

    (@sormano)

    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.

    Plugin Author Jeroen Sormani

    (@sormano)

    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

    Plugin Author Jeroen Sormani

    (@sormano)

    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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PreFix and Export’ is closed to new replies.