Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update WC 7.2.1 quantity input.php #331

Merged
merged 2 commits into from
Jan 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions woocommerce/global/quantity-input.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
* @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce\Templates
* @version 7.2.0
* @version 7.2.1
*/

defined( 'ABSPATH' ) || exit;
Expand All @@ -22,42 +22,42 @@

// In some cases we wish to display the quantity but not allow for it to be changed.
if ( $max_value && $min_value === $max_value ) {
$is_readonly = true;
$input_value = $min_value;
$is_readonly = true;
$input_value = $min_value;
} else {
$is_readonly = false;
$is_readonly = false;
}
?>
<div class="quantity input-group">
<?php
/**
* Hook to output something before the quantity input field.
*
* @since 7.2.0
*/
do_action( 'woocommerce_before_quantity_input_field' );
?>
<?php
/**
* Hook to output something before the quantity input field.
*
* @since 7.2.0
*/
do_action( 'woocommerce_before_quantity_input_field' );
?>
<button type="button" class="input-group-text qty_button minus">-</button>
<label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo esc_attr( $label ); ?></label>
<input
type="<?php echo $is_readonly ? 'text' : 'number'; ?>"
<?php wp_readonly( $is_readonly ); ?>
id="<?php echo esc_attr( $input_id ); ?>"
class="input-text qty text form-control <?php echo esc_attr( join( ' ', (array) $classes ) ); ?>"
name="<?php echo esc_attr( $input_name ); ?>"
value="<?php echo esc_attr( $input_value ); ?>"
title="<?php echo esc_attr_x( 'Qty', 'Product quantity input tooltip', 'woocommerce' ); ?>"
size="4"
min="<?php echo esc_attr( $min_value ); ?>"
max="<?php echo esc_attr( 0 < $max_value ? $max_value : '' ); ?>"
<?php if ( ! $is_readonly ): ?>
step="<?php echo esc_attr( $step ); ?>"
placeholder="<?php echo esc_attr( $placeholder ); ?>"
inputmode="<?php echo esc_attr( $inputmode ); ?>"
autocomplete="<?php echo esc_attr( isset( $autocomplete ) ? $autocomplete : 'on' ); ?>"
<?php endif; ?>
/>
<button type="button" class="input-group-text qty_button plus">+</button>
<label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo esc_attr( $label ); ?></label>
<input
type="<?php echo $is_readonly ? 'text' : 'number'; ?>"
<?php echo $is_readonly ? 'readonly="readonly"' : ''; ?>
id="<?php echo esc_attr( $input_id ); ?>"
class="input-text qty text form-control <?php echo esc_attr( join( ' ', (array) $classes ) ); ?>"
name="<?php echo esc_attr( $input_name ); ?>"
value="<?php echo esc_attr( $input_value ); ?>"
title="<?php echo esc_attr_x( 'Qty', 'Product quantity input tooltip', 'woocommerce' ); ?>"
size="4"
min="<?php echo esc_attr( $min_value ); ?>"
max="<?php echo esc_attr( 0 < $max_value ? $max_value : '' ); ?>"
<?php if ( ! $is_readonly ): ?>
step="<?php echo esc_attr( $step ); ?>"
placeholder="<?php echo esc_attr( $placeholder ); ?>"
inputmode="<?php echo esc_attr( $inputmode ); ?>"
autocomplete="<?php echo esc_attr( isset( $autocomplete ) ? $autocomplete : 'on' ); ?>"
<?php endif; ?>
/>
<button type="button" class="input-group-text qty_button plus">+</button>
<?php
/**
* Hook to output something after quantity input field
Expand Down