Liquid, JavaScript, themes, sales channels
Hello All
I am new here and building a new store and looking to customise the cart & checkout page(s) and need a bit of help please.
In the Cart page I managed to add a line to show the total cart weight using the following code..
'<div> You have {{ cart.item_count }} {{ cart.item_count | pluralize: 'item', 'items' }} in your cart and your total cart weight is {{cart.total_weight}} g</div>'
That shows something like this;
But I need to show the weight in 'kg' rather than in grams. I thought changing the default weight units to 'kg' would do the trick but it didn't.
Could the experts please help me with how I can achieve this please?
Also, being in a basic Shopify plan, would I be able to show the same message (to show the weight) in the checkout page within the 'Shipping method' section so my customers can select the correct shipping option based on the weight?
Thanks in advance.
Solved! Go to the solution
This is an accepted solution.
<div> You have {{ cart.item_count }} {{ cart.item_count | pluralize: 'item', 'items' }} in your cart and your total cart weight is {{cart.total_weight}} g</div>
It is pretty easy, change, we just need to divide it by 100
{{cart.total_weight}}
into
{{cart.total_weight | divided_by: 100}}
And of course change g into kg ))))
Author: Hovhannes Sargsyan (aka sarhov)
Email: shopify@sarhov.com
Website: https://sarhov.com
Try Shopify free for 14 days,
This is an accepted solution.
<div> You have {{ cart.item_count }} {{ cart.item_count | pluralize: 'item', 'items' }} in your cart and your total cart weight is {{cart.total_weight}} g</div>
It is pretty easy, change, we just need to divide it by 100
{{cart.total_weight}}
into
{{cart.total_weight | divided_by: 100}}
And of course change g into kg ))))
Author: Hovhannes Sargsyan (aka sarhov)
Email: shopify@sarhov.com
Website: https://sarhov.com
Try Shopify free for 14 days,
Thank you so much @sarhov , that works a treat.
Any advise on how I can show the same in the checkout page?
Unfortunately checkout page is not editable, unless you're Shopify plus member. ((
Author: Hovhannes Sargsyan (aka sarhov)
Email: shopify@sarhov.com
Website: https://sarhov.com
Try Shopify free for 14 days,
Doesn't it need to be divided by 1000? 1kg = 1000g.
{% assign cart_total_weight = cart.total_weight | divided_by: 1000 %}
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024