Filters
-
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:
ABCDEFGHJKMNPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456789And 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;
}
- The topic ‘Filters’ is closed to new replies.