• Resolved Orion Reve

    (@sahsg29)


    Hello is there a filter I can use to define my own characters and limit the string length?

    I would like to generate only 5-character coupon using these characters:
    ABCDEFGHJKMNPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456789

    And then no – separator.

    I tried these but did not work:
    // Coupon Generator for WooCommerce – Update Characters
    add_filter( ‘woocommerce_coupon_code_generator_characters’, ‘woocommerce_coupon_code_generator_characters’, 10 );
    function woocommerce_coupon_code_generator_characters( $characters ) {
    return ‘ABCDEFGHJKMNPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456789’;
    }

    // Coupon Generator for WooCommerce – Update Length
    add_filter( ‘woocommerce_coupon_code_generator_character_length’, ‘woocommerce_coupon_code_generator_character_length’, 10 );
    function woocommerce_coupon_code_generator_character_length( $length ) {
    return 5;
    }

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

    (@sormano)

    Hi,

    The ‘woocommerce_coupon_generator_random_coupon_code’ filter is available to create a custom code.

    Cheers,
    Jeroen

Viewing 1 replies (of 1 total)
  • The topic ‘Filters’ is closed to new replies.