Cart won't update quantity changes

Solved
Highlighted
Tourist
6 1 0

So I wanted to try giving a <select> option for choosing desired quantity (multiples of 5) using forloop and modulo in the cart page. See below:

 

<select onchange="this.form.submit();" id="updates_{{ item.key }}" name="updates[]" class="cart__product-qty" value="{{ item.quantity }}" min="0" data-id="{{ item.key }}">
   <option selected>Qty</option>
      {% for i in (5..500) %}
         {% assign remainder = i | modulo: 5 %}
         {% if remainder == 0 %}
  	    <option value=i >{{ i }}</option>                      
         {% endif %}
      {% endfor %}
</select>
<label>{{ item.quantity }} </label>

When I list out all the options without using a forloop, the cart is able to successfully update its quantity for each item. But when I use a forloop with modulo, the cart does not get updated...

 

Does anyone know why? I'm curious..

 

 

0 Likes

Success.

Shopify Expert
2201 372 460

 

Hi,

I have checked your code you have added wrong.

<option value=i >{{ i }}</option>

Change it with:

<option value="{{ i }}">{{ i }}</option>

 

Let me know if need help.

 

 

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com
Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
1 Like