Cart totals incorrect

Highlighted
Tourist
7 0 1

Hi

I've just noticed that the price totals in my cart are incorrect. They only include 1 of each product regardless of how many of each product has been selected. For example:

Product A x 1 = £6     [this is correct]
Product B x 3 = £6         [incorrect. Shoulf be £18]
Product C x 2 = £6       [incorrect]. Should be £12
Subtotal = £18     [incorrect. Should be £36]

I was hoping to launch my site tomorrow so any help would be massively appreciated!

Here's the code in cart.liquid (I'm using Classic theme)

 

{% comment %}

  This is your /cart template. If you are using the Ajaxify Cart plugin,
  your form (with action="/cart") layout will be used in the drawer/modal.

  For info on test orders:
    - General http://docs.shopify.com/manual/your-store/orders/test-orders
    - Shopify Payments - http://docs.shopify.com/manual/more/shopify-payments/testing-shopify-payments

{% endcomment %}
{% if cart.item_count > 0 %}

  <form action="/cart" method="post" novalidate class="cart">

    <div class="section-header">
      <h1 class="section-header__title">{{ 'cart.general.title' | t }}</h1>
    </div>

    {% if cart.announcements.size > 0 %}
      <ul class="note">
        {% for announcement in cart.announcements %}
          <li>{{ announcement }}</li>
        {% endfor %}
      </ul>
    {% endif %}

    {% if cart.errors.size > 0 %}
      <ul class="note errors">
        {% for error in cart.errors %}
          <li>{{ error }}</li>
        {% endfor %}
      </ul>
    {% endif %}

    <div class="cart__row medium-down--hide cart__header-labels">
      <div class="grid--full">
        <div class="grid__item large--one-half push--large--one-half">
          <div class="grid--full">
            <div class="grid__item one-third medium-down--one-third">
              <span class="h4">{{ 'cart.label.price' | t }}</span>
            </div>
            <div class="grid__item one-third medium-down--one-third text-center">
              <span class="h4">{{ 'cart.label.quantity' | t }}</span>
            </div>
            <div class="grid__item one-third medium-down--one-third text-right">
              <span class="h4">{{ 'cart.label.total' | t }}</span>
            </div>
          </div>
        </div>
      </div>
    </div>

    {% comment %}
      Loop through products in the cart
    {% endcomment %}
    {% for item in cart.items %}
      <div class="cart__row" data-id="{{ item.id }}">
        <div class="grid--full cart__row--table-large">

          <div class="grid__item large--one-half">
            <div class="grid">

              <div class="grid__item one-third">
                <a href="{{ item.url | within: collections.all }}" class="cart__image">

                  {% comment %}
                    More image size options at:
                      - http://docs.shopify.com/themes/filters/product-img-url
                  {% endcomment %}
                  <img src="{{ item | img_url: 'medium' }}" alt="{{ item.title | escape }}">
                </a>
              </div>

              <div class="grid__item two-thirds">
                <a href="{{ item.url }}" class="h4">
                  {{ item.product.title }}
                </a>
                {% unless item.variant.title contains 'Default' %}
                  <br>
                  <small>{{ item.variant.title }}</small>
                {% endunless %}

                {% if settings.cart_vendor_enable %}
                  <p>{{ item.vendor }}</p>
                {% endif %}

                {% comment %}
                  Optional, loop through custom product line items if available

                  For more info on line item properties, visit:
                    - http://docs.shopify.com/support/your-store/products/how-do-I-collect-additional-information-on-the-p...
                {% endcomment %}
                {% assign propertySize = item.properties | size %}
                {% if propertySize > 0 %}
                  {% for p in item.properties %}
                    {% unless p.last == blank %}
                      {{ p.first }}:

                      {% comment %}
                        Check if there was an uploaded file associated
                      {% endcomment %}
                      {% if p.last contains '/uploads/' %}
                        <a href="{{ p.last }}">{{ p.last | split: '/' | last }}</a>
                      {% else %}
                        {{ p.last }}
                      {% endif %}

                      <br>
                    {% endunless %}
                  {% endfor %}
                {% endif %}

                <a href="/cart/change?line={{ forloop.index }}&amp;quantity=0" data-id="{{ item.id }}" class="cart__remove">
                  <small>{{ 'cart.general.remove' | t }}</small>
                </a>
              </div>

            </div>
          </div>

          <div class="grid__item large--one-half">
            <div class="grid--full cart__row--table-large">

              <div class="grid__item one-third">
                <span class="cart__mini-labels">{{ 'cart.label.price' | t }}</span>
                <span class="h5">{{ item.price | money }}</span>
              </div>

              <div class="grid__item one-third text-center">
                <span class="cart__mini-labels">{{ 'cart.label.quantity' | t }}</span>
                {% comment %}
                  Added data-id for the ajax cart implementation only.
                {% endcomment %}
                <input type="number" name="updates[]" id="updates_{{ item.id }}" value="{{ item.quantity }}" min="0" data-id="{{ item.id }}">
              </div>

              <div class="grid__item one-third text-right">
                <span class="cart__mini-labels">{{ 'cart.label.total' | t }}</span>

                <span class="h5">
                  {% if item.original_line_price != item.line_price %}
                  <small class="cart-item__original-price"><s>{{ item.original_line_price | money }}</s></small>
                  {% endif %}
                  {{ item.line_price | money }}
                </span>
                {% if item.original_line_price != item.line_price %}
                  {% for discount in item.discounts %}
                    <small class="cart-item__discount">{{ discount.title }}</small>
                  {% endfor %}
                {% endif %}
              </div>

            </div>
          </div>

        </div>
      </div>
    {% endfor %}

    {% if cart.discounts.size > 0 %}
    <div class="cart-additional-savings text-right cart__row">
      <span class="label cart-additional-savings__label">{{ 'cart.general.additional_savings' | t }}</span>
      <span class="h5 cart-additional-savings__price">{{ cart.discount.total_savings | money }}</span><br>
      {% for discount in cart.discounts %}
        <small class="cart-additional-savings__savings">{{ discount.title }}</small>
      {% endfor %}
    </div>
    {% endif %}

    <div class="cart__row">
      <div class="grid">
        {% comment %}
          Optional, add a textarea for special notes
            - Your theme settings can turn this on or off. Default is on.
            - Make sure you have name="note" for the message to be submitted properly
        {% endcomment %}
        {% if settings.cart_notes_enable %}
          {% assign noteSize = cart.note | size %}
          <div class="grid__item large--five-twelfths">
            <button type="button" class="text-link cart__note-add{% if noteSize > 0 %} is-hidden{% endif %}">
              {{ 'cart.label.add_note' | t }}
            </button>
            <div class="cart__note{% if noteSize > 0 %} is-active{% endif %}">
              <label for="CartSpecialInstructions">{{ 'cart.general.note' | t }}</label>
              <textarea name="note" class="input-full" id="CartSpecialInstructions">{{ cart.note }}</textarea>
            </div>
          </div>
        {% endif %}
        <div class="grid__item text-right{% if settings.cart_notes_enable %} large--seven-twelfths{% endif %}">
          <p>
            <span class="cart__subtotal-title">{{ 'cart.general.subtotal' | t }}</span>
            <span class="h5 cart__subtotal">{{ cart.total_price | money }}</span><br>
            {% if cart.total_discounts > 0 %}
              {% assign savings = cart.total_discounts | money %}
              <small class="cart-subtotal__savings">{{ 'cart.general.savings_html' | t: price: savings }}</small>
            {% endif %}
          </p>
          <p><em>{{ 'cart.general.shipping_at_checkout' | t }}</em></p>
         {% if cart.total_price < 5000 %}
Minimum order is £50 net. Please add more items to your cart.<p>
 {% else %}
        <input type="submit" name="update" class="btn--secondary update-cart" value="{{ 'cart.general.update' | t }}">
          <input type="submit" name="checkout" class="btn" value="{{ 'cart.general.checkout' | t }}">
          {% if additional_checkout_buttons %}
            <div class="cart__additional_checkout_buttons">{{ content_for_additional_checkout_buttons }}</div>
          {% endif %}
{% endif %}
                    
        </div>
      </div>

    </div>

  </form>

{% else %}
  {% comment %}
    The cart is empty
  {% endcomment %}
  <h2>{{ 'cart.general.title' | t }}</h2>
  <p>{{ 'cart.general.empty' | t }}</p>
  <p>{{ 'cart.general.continue_browsing_html' | t }}</p>
{% endif %}
 

1 Like
Highlighted
Tourist
7 0 1

 

***UPDATE***

I figured out that this problem was being caused by the additional code I had added into product-grid-item.liquid to add an 'Add to cart' button under each product on collection pages. I've now removed that code and the price totals are fine.

However I now need to find another way to add those buttons onto collection pages, so any advice on that would be great. The original code I originally added was:

 

  <form method="post" action="/cart/add">
    <input type="hidden" name="id" value="{{ product.variants.first.id }}" />
    <input type="submit" value="Buy now" class="btn" />
  </form>  

 

 

Thanks,

Roisin 

0 Likes
Highlighted
Tourist
7 0 1

I have a very similar problem. I'm using supply theme and the multi vendor platform.

 

The first problem is that when I add a product to my cart, my cart subtotal equals 0. Then when I start adding products, the cart makes the sum but never counts the last item. Not until next process of checkout or refreshing the page. But This is not correct, my customers won't do that, or they will be confused (to say the least).

 

But looking for an answer to my problem, I found this new problem. And it turns out that my cart doesn't even count the last added item, but also it does the same as posted in here: it does not multiply products. If I choose more than one product, the result is incorrect. Exactly the same as posted in here.

 

Please please help!

0 Likes
Highlighted
Tourist
7 0 1

My problem is fixed thanks to your instructions. Thank you very much!

0 Likes