Custom code format no longer working?
-
(I answered my own question – see reply).
I last used this plugin in 2022, and I added the following code to successfully customize the coupon format:
// Set desired coupon generation format
function set_coupon_format($random_coupon) {
$length = 6;
$charset = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
$count = strlen( $charset );
while ( $length-- ) {
$random_coupon .= $charset[ mt_rand( 0, $count-1 ) ];
}
return $random_coupon;
}
add_filter('woocommerce_coupon_generator_random_coupon_code', 'set_coupon_format', 10, 1);This worked well before, but now when I generate new coupons they come out with the standard format instead of the one I want. The code above is still there, in functions.php of my active theme. I believe I’m using the correct hook. But it’s not being used somehow.
Any tips as to how this is happening and how I fix it?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Custom code format no longer working?’ is closed to new replies.