Title: Need quantity as dropdown
Last modified: August 21, 2016

---

# Need quantity as dropdown

 *  [amin9](https://wordpress.org/support/users/amin9/)
 * (@amin9)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/need-quantity-as-dropdown/)
 * In the product single page. I replaced the quantity text box with a select. Now
   it only displaying the first option, other options are hidden.
 * Any dropdown select I’m adding manually, does the same. But variable selets are
   working fine.
 * Please help me to resolve the issue.
 * [https://wordpress.org/plugins/woocommerce/](https://wordpress.org/plugins/woocommerce/)

Viewing 1 replies (of 1 total)

 *  [tweakben](https://wordpress.org/support/users/tweakben/)
 * (@tweakben)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/need-quantity-as-dropdown/#post-4970279)
 *     ```
       <?php
       // Place the following code in your theme's functions.php file
       // override the quantity input with a dropdown
       function woocommerce_quantity_input() {
           global $product;
   
       	$defaults = array(
       		'input_name'  	=> 'quantity',
       		'input_value'  	=> '1',
       		'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 ),
       		'style'		=> apply_filters( 'woocommerce_quantity_style', 'float:left; margin-right:10px;', $product )
       	);
       	if ( ! empty( $defaults['min_value'] ) )
       		$min = $defaults['min_value'];
       	else $min = 1;
   
       	if ( ! empty( $defaults['max_value'] ) )
       		$max = $defaults['max_value'];
       	else $max = 20;
   
       	if ( ! empty( $defaults['step'] ) )
       		$step = $defaults['step'];
       	else $step = 1;
   
       	$options = '';
       	for ( $count = $min; $count <= $max; $count = $count+$step ) {
       		$options .= '<option value="' . $count . '">' . $count . '</option>';
       	}
       	echo '<div class="quantity_select" style="' . $defaults['style'] . '"><select name="' . esc_attr( $defaults['input_name'] ) . '" title="' . _x( 'Qty', 'Product quantity input tooltip', 'woocommerce' ) . '" class="qty">' . $options . '</select></div>';
       }
       ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Need quantity as dropdown’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [dropdown](https://wordpress.org/support/topic-tag/dropdown/)
 * [jquery](https://wordpress.org/support/topic-tag/jquery/)
 * [quantity](https://wordpress.org/support/topic-tag/quantity/)

 * 1 reply
 * 2 participants
 * Last reply from: [tweakben](https://wordpress.org/support/users/tweakben/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/need-quantity-as-dropdown/#post-4970279)
 * Status: not resolved