Updating Product Quantity in Cart

Solved
Highlighted
New Member
2 1 0

Hi, I don't know what I'm doing wrong. I know there's already a lot of posts about this but I can't find the solution to my problem. I can't get to update the product quantity in my cart when I click the update button nothing happens, the page reloads but the quantity doesn't change.

Basically, this is my code:

Product item inside cart:

{% for item in cart.items%}
  <div class="columns is-mobile product">
    <div class="column product-image">
      <figure class="image">
        <img src="{{ item.image | product_img_url: '1920x' }}">
      </figure>
    </div>
    <div class="column">
      <div class="columns is-mobile">
        <div class="column is-four-fifths product-details">
          <a href="{{ item.url }}">
            <h2 class="title is-3 is-size-6-mobile has-text-primary">{{ item.title }}</h2>
          </a>
          <form>
            <div class="field">
              <div class="control">
                <input type="number" id="updates_{{ item.id }}" name="updates[]" value="{{ item.quantity }}" class="input" />
              </div>
            </div>
          </form>
          <p class="title is-3 is-size-6 is-size-7-mobile has-text-primary price">{{ item.price | money }}</p>
        </div>
        <div class="column remove-product">
          <a href="/cart/change?line={{ forloop.index }}&quantity=0" rel="{{ item.id }}" class="has-text-primary is-size-3">x
          </a>
        </div>
      </div>
    </div>
  </div>
{% endfor %}

Cart Form:

<form action="/cart" method="post">
  <input type="submit" name="checkout" value="checkout" class="button is-small is-rounded is-primary is-uppercase has-text-centered" />
  <input type="submit" name="update" value="update" class="button is-small is-rounded is-primary is-outlined is-uppercase has-text-centered" />
</form>

I will really appreciate any helpful feedback, I already spent hours trying to fix this, I followed this guide https://help.shopify.com/en/themes/development/templates/cart-liquid but is not working for me.

Thanks

0 Likes

Success.

New Member
2 1 0

My bad. Was a simple fix everything has to be inside the same form.

0 Likes