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:
Barry Hughes 2021-11-15 17:30:54 -08:00 committed by GitHub
commit be1c879e47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -1773,6 +1773,9 @@ if ( ! function_exists( 'woocommerce_quantity_input' ) ) {
'inputmode' => apply_filters( 'woocommerce_quantity_input_inputmode', has_filter( 'woocommerce_stock_amount', 'intval' ) ? 'numeric' : '' ),
'product_name' => $product ? $product->get_title() : '',
'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 );

View File

@ -42,7 +42,9 @@ if ( $max_value && $min_value === $max_value ) {
title="<?php echo esc_attr_x( 'Qty', 'Product quantity input tooltip', 'woocommerce' ); ?>"
size="4"
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' ); ?>
</div>
<?php