From e9ff3963483520816c7f1c726e9071f3fc7ed12a Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Fri, 26 Feb 2016 14:36:53 +0000 Subject: [PATCH] Only add when using intval for stock amounts --- includes/wc-template-functions.php | 12 +++++++----- templates/global/quantity-input.php | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index 9ca9633faf7..23905c05b5c 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -997,11 +997,13 @@ if ( ! function_exists( 'woocommerce_quantity_input' ) ) { } $defaults = array( - 'input_name' => 'quantity', - 'input_value' => '1', - 'max_value' => apply_filters( 'woocommerce_quantity_input_max', '', $product ), - 'min_value' => apply_filters( 'woocommerce_quantity_input_min', '', $product ), - 'step' => apply_filters( 'woocommerce_quantity_input_step', '1', $product ) + 'input_name' => 'quantity', + 'input_value' => '1', + 'max_value' => apply_filters( 'woocommerce_quantity_input_max', '', $product ), + 'min_value' => apply_filters( 'woocommerce_quantity_input_min', '', $product ), + 'step' => apply_filters( 'woocommerce_quantity_input_step', '1', $product ), + 'pattern' => apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ), + 'inputmode' => apply_filters( 'woocommerce_quantity_input_inputmode', has_filter( 'woocommerce_stock_amount', 'intval' ) ? 'numeric' : '' ), ); $args = apply_filters( 'woocommerce_quantity_input_args', wp_parse_args( $args, $defaults ), $product ); diff --git a/templates/global/quantity-input.php b/templates/global/quantity-input.php index 86c22f09150..ee334d8ab04 100644 --- a/templates/global/quantity-input.php +++ b/templates/global/quantity-input.php @@ -21,5 +21,5 @@ if ( ! defined( 'ABSPATH' ) ) { } ?>
- +