Tutorial How to convert Quantity to dropdown selecbox in shopify?

Shopify Partner
4 0 1

If you want that on product details page the quantity input should be as dropdown/select option then you can do this by just replacing your old code to our new code. Just open your product.liquid file and find quantity and you will see:
Old code :

Code:

<input id="quantity" type="number" name="quantity" value="1" class="tc item-quantity" />



Now just replace above code with our new code shown below:
New code:

Code:

<select name="quantity" id="quantity">
         {% for i in (1..4) %}
                  <option value="{{ i }}">{{ i }}</option>
          {% endfor %}         
</select>

Visit http://www.DevelopersAdda.com for more shopify updates !!
1 Like
Highlighted
Shopify Partner
4 0 1

HERE YOU CAN CHANGE THE 4 TO ANY NUMBER YOU WANT IF YOU WANT TO SHOW 1 TO 20 THEN WRITE 1..20

Visit http://www.DevelopersAdda.com for more shopify updates !!
0 Likes
Highlighted
Excursionist
40 2 1

@RAJESH_KUMAR_Y1 

Hi, this works but when it comes to the pop-up in the right hand corner it says "qty 1" 

0 Likes