Hi,
How to show weight in every products and total weight in cart for Craft theme?
I spend few days for trying to do this. But any code I found is not worked. Got really tired of this.
Can any one help to fix this?
Thank you in advance.
Hi,
How to show weight in every products and total weight in cart for Craft theme?
I spend few days for trying to do this. But any code I found is not worked. Got really tired of this.
Can any one help to fix this?
Thank you in advance.
To display total weight on cart page add this code in your liquid file which is responsible for displaying cart page
{% assign totalWeight = 0 %}
{% for item in cart.items %}
{% assign productWeight = item.variant.weight | weight_with_unit %}
{% assign productQuantity = item.quantity %}
{% assign productTotalWeight = productWeight | times: productQuantity %}
{% assign totalWeight = totalWeight | plus: productTotalWeight %}
{% endfor %}
Total Cart Weight: {{ totalWeight }}
Hi Asad,
Thanks for the help. However, it only shows the number: Total Cart Weight: 2
And it shows in cart on the left side. Should be on the right.
Is there any way to show weight in every item card? Not only the total in the cart?
Yes you can show weight on each produt with unit by using this variable
{{ selected_variant.weight | weight_with_unit }}
Appears, but only zeros. Does not show weights.
And shows in the bottom left corner.
It should be displayed in a visible place, at the bottom of the size variations or similar.
I don’t really understand coding. I am new to Shopify. So maybe I’m not uploading it where it should be.
If you’d like me to provide a more thorough examination of your store, I’ll require collaborator access to effectively meet your needs.
How to make a “real-time” update of “Total Cart Weight” in this code?
For example, if you add quantity for the product in the cart, the total cart weight is not updated and you need to refresh the page. How to correct it?