Title: Drop down quantity selector
Last modified: August 31, 2016

---

# Drop down quantity selector

 *  Resolved [carver1g](https://wordpress.org/support/users/carver1g/)
 * (@carver1g)
 * [10 years ago](https://wordpress.org/support/topic/drop-down-quantity-selector/)
 * I have fields cloning enabled and with the default woocommerce quantity selector
   all works perfectly.
    I am now using a drop down quantity selector but the fields
   are not being reproduced. Here is the code I am using for the selector:
 * 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>
 * Was wondering if I could hook into this code with your plugin or if maybe an 
   update in the future would include the use of a drop down selector?
 * Thanks
 * [https://wordpress.org/plugins/wc-fields-factory/](https://wordpress.org/plugins/wc-fields-factory/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Saravana Kumar K](https://wordpress.org/support/users/mycholan/)
 * (@mycholan)
 * [10 years ago](https://wordpress.org/support/topic/drop-down-quantity-selector/#post-7336301)
 * Hi,
 * The reason is the `change` event for the quantity field has been registered for
   the `input` field.
 * update the `wc-fields-factory/assets/js/wccpf-front-end.js` LN : 25 with the 
   following line.
 * `$( document ).on( "change", "select.qty", function() {`
 *  Thread Starter [carver1g](https://wordpress.org/support/users/carver1g/)
 * (@carver1g)
 * [10 years ago](https://wordpress.org/support/topic/drop-down-quantity-selector/#post-7336420)
 * Thank you very much. Works absolutely perfect! Sir, you are a genius!
 *  [qaqeqe0](https://wordpress.org/support/users/qaqeqe0/)
 * (@qaqeqe0)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/drop-down-quantity-selector/#post-8175861)
 * Hello carver1g!
    Can you guide to me this problem? Thank you!
 *  Thread Starter [carver1g](https://wordpress.org/support/users/carver1g/)
 * (@carver1g)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/drop-down-quantity-selector/#post-8182308)
 * [@qaqeqe0](https://wordpress.org/support/users/qaqeqe0/)
    What can I help you
   with?
 *  [qaqeqe0](https://wordpress.org/support/users/qaqeqe0/)
 * (@qaqeqe0)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/drop-down-quantity-selector/#post-8192308)
 * Hi there!
    You can guide clone woocommerce quantity, do quantity to quantity 
   dropdown in plugin wc_factory_field. Thank you
 *  Thread Starter [carver1g](https://wordpress.org/support/users/carver1g/)
 * (@carver1g)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/drop-down-quantity-selector/#post-8202571)
 * This basically what I did. I am using a child theme and created a folder ‘woocommerce’.
   Inside the ‘woocommerce’ folder I created another folder ‘global’.
 *  Copy and paste the above code in a text editor and save it as quantity-input.
   php. Place this file in the global folder you created. This file will replace
   the default woocommerce quantity selector with a drop down selector.
 *  Then go to the WC Fields Factory plugin/assets/js/wccpf-front-end.js. Edit the
   wccpf-front-end.js file by dragging and dropping into a text editor.
 *  Look for this line “$( document ).on( “change”, “input[name=quantity]”, function(){“,
   function() {” and change this line to “$( document ).on( “change”, “select.qty”,
   function() {“.
 *  Replace “input[name=quantity]” with “select.qty”.
 * Hope this helps.
 *  [qaqeqe0](https://wordpress.org/support/users/qaqeqe0/)
 * (@qaqeqe0)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/drop-down-quantity-selector/#post-8208172)
 * Thank you very much. Works absolutely perfect!
    -  This reply was modified 9 years, 7 months ago by [qaqeqe0](https://wordpress.org/support/users/qaqeqe0/).

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Drop down quantity selector’ is closed to new replies.

 * ![](https://ps.w.org/wc-fields-factory/assets/icon-128x128.jpg?rev=2738843)
 * [WC Fields Factory](https://wordpress.org/plugins/wc-fields-factory/)
 * [Support Threads](https://wordpress.org/support/plugin/wc-fields-factory/)
 * [Active Topics](https://wordpress.org/support/plugin/wc-fields-factory/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wc-fields-factory/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wc-fields-factory/reviews/)

## Tags

 * [code](https://wordpress.org/support/topic-tag/code/)
 * [drop-down](https://wordpress.org/support/topic-tag/drop-down/)
 * [quantity](https://wordpress.org/support/topic-tag/quantity/)
 * [selector](https://wordpress.org/support/topic-tag/selector/)

 * 7 replies
 * 3 participants
 * Last reply from: [qaqeqe0](https://wordpress.org/support/users/qaqeqe0/)
 * Last activity: [9 years, 7 months ago](https://wordpress.org/support/topic/drop-down-quantity-selector/#post-8208172)
 * Status: resolved