Show number of diff...
 
Notifications
Clear all

Show number of different products in cart instead of total

5 Posts
2 Users
1 Reactions
1,493 Views
remi
 remi
(@remi)
Active Member
Joined: 4 years ago
Posts: 12
Topic starter  

Our shop has loads of small products that people usually buy quantities of. Therefore I'd like to display the number of unique products in the shopping cart batches, instead of the total amount of products (product x qty). So if I buy 3 products each qty=100, it now displays "300" and I'd like to see "3" instead.

I found I could change cart.item_count to cart.items.size in header.liquid This works, but when I add something to the card it does the old behaviour again and so shows 400 instead of 4. The same in the cart pop-up, etc. So I still need to replace some more 🙂 Any hints on how to go from here?

Thanks!
Remi


   
Quote
plaktheme
(@plaktheme)
Reputable Member
Joined: 5 years ago
Posts: 0
 

Hi @remi

 

this needs some medications in cart, header and vendor.js files in order to make the update work automatically.

I will keep you updated

Kind regards,

Katrine | Technical support at Plak, Scrowp & Vantout
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as a Solved Solution


   
ReplyQuote
remi
 remi
(@remi)
Active Member
Joined: 4 years ago
Posts: 12
Topic starter  

Thanks in advance! 🙂


   
ReplyQuote
plaktheme
(@plaktheme)
Reputable Member
Joined: 5 years ago
Posts: 0
 

Hi @remi

I am back with step by steps tutorial to change the total items to total products in cart icon on the top & cart page.

  • From your Shopify dashboard click Online store > Actions > Edit code
  • Open the file header.liquid
  • Change this code
{{ cart.item_count }}
  • With this one
{{ cart.items.size }}
  • Click Save
  • Open the file cart-template.liquid
  • Change this code
 <div class="cart-subtotal">
<span class="cart-subtotal__title">{{ 'cart.general.subtotal' | t }}</span>
<span class="cart-subtotal__price" data-cart-subtotal><span class="money">{{ cart.total_price | money_with_currency }}</span></span>
</div>
  • With this one
 <div class="cart-subtotal hide">
<span class="cart-subtotal__title">{{ 'cart.general.subtotal' | t }}</span>
<span class="cart-subtotal__price" data-cart-subtotal><span class="money">{{ cart.total_price | money_with_currency }}</span></span>
</div>
<div>
<span class="cart-subtotal__title">Total products: </span>
<span class="cart-total-item"><strong> {{ cart.items.size }} </strong></span>
</div>
  • Click Save
  • Now change all your vendor.js content with this one
  • Click Save

 

Best regards,
Katrine

 

Katrine | Technical support at Plak, Scrowp & Vantout
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as a Solved Solution


   
ReplyQuote
remi
 remi
(@remi)
Active Member
Joined: 4 years ago
Posts: 12
Topic starter  

Hi Katrine @plaktheme,

This is very cool and works great 🙂 Thank you so much for another fantastic experience. So happy to have Plaktheme! 👍 😍 

Have a great weekend!

Remi


   
plaktheme reacted
ReplyQuote
Share:

Welcome to the Shopify Forum Community provided by Plak ThemeLLC, a place where you can discuss about eCommerce and Shopify, solve technical issues, get help with Shopify Design, Apps integration, Marketing, Facebooks ad, Google ads and more.

Before posting, we invite you to read and follow the forum rules | We also support any questions related to Free Shopify themes :Dawn, Express, Minimal, Brooklyn, Narrative, Supply, Debut, Venture, Boundless and Simple