Няма описание

quantity-input.php 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. defined( 'ABSPATH' ) || exit;
  18. if ( $max_value && $min_value === $max_value ) {
  19. ?>
  20. <div class="quantity hidden">
  21. <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 ); ?>" />
  22. </div>
  23. <?php
  24. } else {
  25. /* translators: %s: Quantity. */
  26. $label = ! empty( $args['product_name'] ) ? sprintf( esc_html__( '%s quantity', 'woocommerce' ), wp_strip_all_tags( $args['product_name'] ) ) : esc_html__( 'Quantity', 'woocommerce' );
  27. ?>
  28. <div class="quantity">
  29. <?php do_action( 'woocommerce_before_quantity_input_field' ); ?>
  30. <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo esc_attr( $label ); ?></label>
  31. <input
  32. type="number"
  33. id="<?php echo esc_attr( $input_id ); ?>"
  34. class="<?php echo esc_attr( join( ' ', (array) $classes ) ); ?>"
  35. step="<?php echo esc_attr( $step ); ?>"
  36. min="<?php echo esc_attr( $min_value ); ?>"
  37. max="<?php echo esc_attr( 0 < $max_value ? $max_value : '' ); ?>"
  38. name="<?php echo esc_attr( $input_name ); ?>"
  39. value="<?php echo esc_attr( $input_value ); ?>"
  40. title="<?php echo esc_attr_x( 'Qty', 'Product quantity input tooltip', 'woocommerce' ); ?>"
  41. size="4"
  42. placeholder="<?php echo esc_attr( $placeholder ); ?>"
  43. inputmode="<?php echo esc_attr( $inputmode ); ?>" />
  44. <?php do_action( 'woocommerce_after_quantity_input_field' ); ?>
  45. </div>
  46. <?php
  47. }