From f957546cc48c59d9f194b882203e6a87ac87fdd8 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Fri, 18 Aug 2017 15:43:34 +0100 Subject: [PATCH] Format coupon code with mb_strtolower Fixes #16497 --- includes/wc-core-functions.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/wc-core-functions.php b/includes/wc-core-functions.php index e0d84f4fc38..aaf33b2cf6f 100644 --- a/includes/wc-core-functions.php +++ b/includes/wc-core-functions.php @@ -37,7 +37,11 @@ include( WC_ABSPATH . 'includes/wc-webhook-functions.php' ); */ add_filter( 'woocommerce_coupon_code', 'html_entity_decode' ); add_filter( 'woocommerce_coupon_code', 'sanitize_text_field' ); -add_filter( 'woocommerce_coupon_code', 'strtolower' ); // Coupons case-insensitive by default +if ( function_exists( 'mb_strtolower' ) ) { + add_filter( 'woocommerce_coupon_code', 'mb_strtolower' ); +} else { + add_filter( 'woocommerce_coupon_code', 'strtolower' ); +} add_filter( 'woocommerce_stock_amount', 'intval' ); // Stock amounts are integers by default add_filter( 'woocommerce_shipping_rate_label', 'sanitize_text_field' ); // Shipping rate label @@ -1530,7 +1534,7 @@ function wc_get_logger() { wc_doing_it_wrong( __FUNCTION__, sprintf( - /* translators: 1: class name 2: woocommerce_logging_class 3: WC_Logger_Interface */ + /* translators: 1: class name 2: woocommerce_logging_class 3: WC_Logger_Interface */ __( 'The class %1$s provided by %2$s filter must implement %3$s.', 'woocommerce' ), '' . esc_html( is_object( $class ) ? get_class( $class ) : $class ) . '', 'woocommerce_logging_class',