Show the weight of all products in the cart with the same product's SKU or TAG

3 1 1

Hello there Shopify society,

I need an advice regarding the cart's product's weight.
I need to show the message to customers if the go over the limit for certain products.
I managed to show the message if each product's weight with SKU E1 go over 1000g, but I need to show the message if the weight of all products in the cart with SKU 'E1' have more than 1000g.
How can I show that, I tried with {{cart.total_weight}} , but it show the weight of all products, not only total product of items with SKU 'E1'? I would really appreciate if you could help me. I tried some apps, but they don't work.



{% if item.variant.sku contains 'E1'%}

{%if item_weight_cart < 1000 %}
<p style="color: red;"> This item is considered to be a Dangerous good.</p>
{%if item_weight_cart > 1000 %}
<p style="color: red;"> You have some Dangerous good items in your cart .<br> You have reached the limit for Dangerous good items. Please, lower the quantity.</p>

{%if cart.total_weight > 1000 %}
<p style="color: red;"> The total weight of all items with E1 regulation is over the limit, please lower the quantity. </p>



Replies 0 (0)