how to display item.quantity in mini cart

Abbyxia
Tourist
14 0 3

Hi,

We have a mini cart liquid file, we can display quantity by using rv-text="item.quantity", but if we used {{item.quantity}}, it will display 0. after added
{% for item in cart.items %}, we can only display the first product quantity.

How can we change the code here?

thanks

Abby

 

 

     {% for item in cart.items %}
  <div id="cart-drawer" class="block block-cart">
	<a href="javascript&colon;void(0);" class="close-cart"><i class="ad ad-times-r " aria-hidden="true"></i></a>
	<h4>{{ 'cart.general.title' | t }}</h4>
	<ul class="mini-products-list" data-cart-view="data-cart-view">
     
		<li id="cart-title" rv-show="cart.item_count | lt 1">{{ 'cart.general.empty' | t }}</li>
   
		<li class="grid" rv-each-item="cart.items">
			<a class="grid__item one-third medium-up--one-quarter product-image" rv-href="item.url"><img rv-src="item.image" rv-alt="item.title" /></a>
			<div class="grid__item two-thirds medium-up--three-quarters product-details">
              	<a href="#" class="remove" rv-data-cart-remove="index | plus 1"><i class="ad ad-times-sql" aria-hidden="true"></i></a>
              	<a class="pName" rv-href="item.url" rv-text="item.product_title"></a>
				<div class="vropts" rv-text="item.variant_title"></div>
				<ul rv-hide="item.propertyArray | empty">
					<li rv-each-property="item.propertyArray < properties"><small class="text-muted">{property.name}: {property.value}</small></li>
				</ul>
				<div class="priceRow"><span class="product-price" rv-html="item.price|money"></span> 
                  <br>
                {{ 'products.product.quantity' | t }}: <span rv-text="item.quantity"></span> Box
                      
                  <br> SQM: <span>{{item.quantity}}</span> <span class="price-unit">m<sub>2</sub></span>
              
              </div>
			</div>
		</li>


		<li class="cart-subtotal-row flex" rv-show="cart.item_count | gt 0"> <span>{{ 'cart.general.subtotal' | t }}:</span> <span class="product-price" rv-html="cart.total_price | money currency.currentCurrency"></span></li>
		<li class="buttonSet" rv-show="cart.item_count | gt 0">
			{%- if settings.free_ship_minicart and settings.free_ship != blank and settings.free_ship_msg != blank -%}
				{%- assign shipProd = all_products[settings.free_ship] -%}
                <p id="freeShipMsg" class="freeShipMsg" data-price="{{shipProd.price}}"><i class="ad ad-truck-l"></i> {{settings.free_ship_msg | replace: '$','<b class="freeShip"></b>' }}</p>
                <p id="freeShipclaim" class="freeShipMsg freeShipclaim"><i class="ad ad-truck-l"></i> {{settings.got_free_ship }}</p>
			{%- endif -%}			
			{%- if settings.terms_checkbox -%}
				<div class="cart_tearm">
					<input type="checkbox" name="tearm" id="cartDWtearm" class="checkbox" value="tearm" required />
					<label for="cartDWtearm"><span class="checkbox"></span> {{ settings.terms_text}}</label>
				</div>
			{%- endif -%}          	
			<form action="/cart" method="post" novalidate>
				<input type="submit" name="checkout" id="cartDWcheckout" class="btn cartDWcheckout" value="{{ 'cart.general.checkout' | t }}" {% if settings.terms_checkbox %}disabled="disabled"{% endif %} />
			</form>
          <a id="inlinecheckout-cart" href="/cart" class="btn btn--secondary">{{ 'cart.general.view_cart' | t }}</a>
		</li>
	</ul>
</div>
       {% endfor %}

 

Replies 3 (3)

Qualitycheck
Shopify Expert
1449 114 233

Please Share a Store url to better assist.

Abbyxia
Tourist
14 0 3

Hi, This is our store URL : https://tilehaus.co.nz/, PW: fowmea

by using  <span rv-text="item.quantity"></span>, we can display the qunatity.

on the second line, we tried to use {{item.quantity | times: "vaule" }}, But it can only display the quantity for the first product.

Thanks

Abby

KetanKumar
Shopify Partner
36845 3636 11978

@Abbyxia 

https://ui-elements-generator.myshopify.com/pages/cart-attribute

If helpful then please Like and Accept Solution.
Want to modify or custom changes on store Hire me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help
Shopify Partner | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing