Merge pull request #16519 from woocommerce/fix/16497

Format coupon code with mb_strtolower
This commit is contained in:
Claudiu Lodromanean 2017-08-18 08:28:40 -07:00 committed by GitHub
commit db8ee8d306
1 changed files with 6 additions and 2 deletions

View File

@ -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