I am trying to get the weight of a product based on what was entered for that product as weight. From there use an IF statement to show the shipping fee or Free Shipping.
Here is the code I currently have but it’s not working at all.
{% if currentvariant.weight == '99' %}
FREE WORLDWIDE SHIPPING
{% endif %}
If a product has a weight entered as 99, it’s set for free shipping. So I am trying to get it to show Free Worldwide Shipping.
The template being used is Debut.
The file I am placing the code in is the product-template.liquid
I have also tried to assign a variable to it. For example:
{% assign the_weight = currentvariant.weight %}
{% if the_weight == '99' %}
FREE WORLDWIDE SHIPPING
{% endif %}
I have also tried using ‘99.0’ just in case it is putting the .0 in the variable and that does not work either.
I have also tried variant.weight
and that does not work either.
2
Answers
I figured it out. Just in case anyone want's to do this, here is the code that I am using.
That's based on the fact that I have the weight on some products set to 99.0 lbs and set that weight to Free Shipping. You will need to change the 99.0 lb to what ever weight you have set to Free Shipping and if you don't have your weight set in lbs change that to your weight as well. Example: 99.0 kg
The Skip is in there because it will show Free Shipping for every variant you have for that product and we only want to show it once.
Try to use in product-template file-