breadcrumb.php
6 years ago
form-login.php
6 years ago
quantity-input.php
6 years ago
sidebar.php
6 years ago
wrapper-end.php
6 years ago
wrapper-start.php
6 years ago
quantity-input.php
50 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Product quantity inputs |
| 4 | * |
| 5 | * This template can be overridden by copying it to yourtheme/woocommerce/global/quantity-input.php. |
| 6 | * |
| 7 | * HOWEVER, on occasion WooCommerce will need to update template files and you |
| 8 | * (the theme developer) will need to copy the new files to your theme to |
| 9 | * maintain compatibility. We try to do this as little as possible, but it does |
| 10 | * happen. When this occurs the version of the template file will be bumped and |
| 11 | * the readme will list any important changes. |
| 12 | * |
| 13 | * @see https://docs.woocommerce.com/document/template-structure/ |
| 14 | * @package WooCommerce/Templates |
| 15 | * @version 4.0.0 |
| 16 | */ |
| 17 | |
| 18 | defined( 'ABSPATH' ) || exit; |
| 19 | |
| 20 | if ( $max_value && $min_value === $max_value ) { |
| 21 | ?> |
| 22 | <div class="quantity hidden"> |
| 23 | <input type="hidden" id="<?php echo esc_attr( $input_id ); ?>" class="qty" name="<?php echo esc_attr( $input_name ); ?>" value="<?php echo esc_attr( $min_value ); ?>" /> |
| 24 | </div> |
| 25 | <?php |
| 26 | } else { |
| 27 | /* translators: %s: Quantity. */ |
| 28 | $label = ! empty( $args['product_name'] ) ? sprintf( esc_html__( '%s quantity', 'woocommerce' ), wp_strip_all_tags( $args['product_name'] ) ) : esc_html__( 'Quantity', 'woocommerce' ); |
| 29 | ?> |
| 30 | <div class="quantity"> |
| 31 | <?php do_action( 'woocommerce_before_quantity_input_field' ); ?> |
| 32 | <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo esc_attr( $label ); ?></label> |
| 33 | <input |
| 34 | type="number" |
| 35 | id="<?php echo esc_attr( $input_id ); ?>" |
| 36 | class="<?php echo esc_attr( join( ' ', (array) $classes ) ); ?>" |
| 37 | step="<?php echo esc_attr( $step ); ?>" |
| 38 | min="<?php echo esc_attr( $min_value ); ?>" |
| 39 | max="<?php echo esc_attr( 0 < $max_value ? $max_value : '' ); ?>" |
| 40 | name="<?php echo esc_attr( $input_name ); ?>" |
| 41 | value="<?php echo esc_attr( $input_value ); ?>" |
| 42 | title="<?php echo esc_attr_x( 'Qty', 'Product quantity input tooltip', 'woocommerce' ); ?>" |
| 43 | size="4" |
| 44 | placeholder="<?php echo esc_attr( $placeholder ); ?>" |
| 45 | inputmode="<?php echo esc_attr( $inputmode ); ?>" /> |
| 46 | <?php do_action( 'woocommerce_after_quantity_input_field' ); ?> |
| 47 | </div> |
| 48 | <?php |
| 49 | } |
| 50 |