All things Shopify and commerce
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.
Thanks
{% 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>
{%endif%}
{%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>
{%endif%}
{%endif%}
I am sure this is a bit late... But I was looking for something similar and came up with this solution:
Depending on your version of shopify theme... But on the cart page, before if displays each item: we wanted to trigger a custom quote for for items that would weigh more than UPS would allow (150 pounds)
{% for item in cart.items %}
{% capture itemUnitWeight %}{{item.grams | divided_by: 453.592}}{% endcapture %}
{% capture itemTotalWeight %}{{ itemUnitWeight | times: item.quantity }}{% endcapture %}
{% if itemTotalWeight > 149 %}
{% assign requires_quote = true %}
{% endif %}
...
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024