Merge pull request #31196 from woocommerce/fix/30733
Set autocomplete off in cart quantity input field to show actual value.
This commit is contained in:
commit
be1c879e47
|
@ -1773,6 +1773,9 @@ if ( ! function_exists( 'woocommerce_quantity_input' ) ) {
|
||||||
'inputmode' => apply_filters( 'woocommerce_quantity_input_inputmode', has_filter( 'woocommerce_stock_amount', 'intval' ) ? 'numeric' : '' ),
|
'inputmode' => apply_filters( 'woocommerce_quantity_input_inputmode', has_filter( 'woocommerce_stock_amount', 'intval' ) ? 'numeric' : '' ),
|
||||||
'product_name' => $product ? $product->get_title() : '',
|
'product_name' => $product ? $product->get_title() : '',
|
||||||
'placeholder' => apply_filters( 'woocommerce_quantity_input_placeholder', '', $product ),
|
'placeholder' => apply_filters( 'woocommerce_quantity_input_placeholder', '', $product ),
|
||||||
|
// When autocomplete is enabled in firefox, it will overwrite actual value with what user entered last. So we default to off.
|
||||||
|
// See @link https://github.com/woocommerce/woocommerce/issues/30733.
|
||||||
|
'autocomplete' => apply_filters( 'woocommerce_quantity_input_autocomplete', 'off', $product ),
|
||||||
);
|
);
|
||||||
|
|
||||||
$args = apply_filters( 'woocommerce_quantity_input_args', wp_parse_args( $args, $defaults ), $product );
|
$args = apply_filters( 'woocommerce_quantity_input_args', wp_parse_args( $args, $defaults ), $product );
|
||||||
|
|
|
@ -42,7 +42,9 @@ if ( $max_value && $min_value === $max_value ) {
|
||||||
title="<?php echo esc_attr_x( 'Qty', 'Product quantity input tooltip', 'woocommerce' ); ?>"
|
title="<?php echo esc_attr_x( 'Qty', 'Product quantity input tooltip', 'woocommerce' ); ?>"
|
||||||
size="4"
|
size="4"
|
||||||
placeholder="<?php echo esc_attr( $placeholder ); ?>"
|
placeholder="<?php echo esc_attr( $placeholder ); ?>"
|
||||||
inputmode="<?php echo esc_attr( $inputmode ); ?>" />
|
inputmode="<?php echo esc_attr( $inputmode ); ?>"
|
||||||
|
autocomplete="<?php echo esc_attr( isset( $autocomplete ) ? $autocomplete : 'on' ); ?>"
|
||||||
|
/>
|
||||||
<?php do_action( 'woocommerce_after_quantity_input_field' ); ?>
|
<?php do_action( 'woocommerce_after_quantity_input_field' ); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
Loading…
Reference in New Issue