Created
April 30, 2014 12:37
-
-
Save chrisvanpatten/6a63fbe6bae94cc2d462 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Product quantity inputs | |
* | |
* @author WooThemes | |
* @package WooCommerce/Templates | |
* @version 2.1.0 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly | |
global $product; | |
$defaults = array( | |
'max_value' => apply_filters( 'woocommerce_quantity_input_max', '', $product ), | |
'min_value' => apply_filters( 'woocommerce_quantity_input_min', '', $product ), | |
'step' => apply_filters( 'woocommerce_quantity_input_step', '1', $product ), | |
); | |
if ( ! empty( $defaults['min_value'] ) ) | |
$min = $defaults['min_value']; | |
else $min = 1; | |
if ( ! empty( $defaults['max_value'] ) ) | |
$max = $defaults['max_value']; | |
else $max = 10; | |
if ( ! empty( $defaults['step'] ) ) | |
$step = $defaults['step']; | |
else $step = 1; | |
?> | |
<div class="quantity_select"> | |
<select name="<?php echo esc_attr( $input_name ); ?>" title="<?php _ex( 'Qty', 'Product quantity input tooltip', 'woocommerce' ) ?>" class="qty"> | |
<?php | |
for ( $count = $min; $count <= $max; $count = $count+$step ) { | |
if ( $count == $input_value ) | |
$selected = ' selected'; | |
else $selected = ''; | |
echo '<option value="' . $count . '"' . $selected . '>' . $count . '</option>'; | |
} | |
?> | |
</select> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment