All things Shopify and commerce
Hi gurus and more experienced users
I have a very simple question that you may be able to answer easily...
When I put {{ total_price | minus: discounts_savings }} in the packing slip template coding, it returns a correct value that I am after.
But I couldn't find a way to put the above into an 'if statement' as below...
Any ideas?
{% if total_price | minus: discounts_savings >=35000 %}
Solved! Go to the solution
This is an accepted solution.
Hey John,
Liquid if statements can act pretty strange at times with no rhyme or reason.
Try assigning a variable to the filter, and then use that variable inside the if statement instead.
{% assign variable = total_price | minus: discounts_savings %}
{% if variable >= 35000 %}
your code here...
{% endif %}
It might do the trick for you.
Cheers,
Hi @John_jmk
What value did this code return?
{{ total_price | minus: discounts_savings }}
- Helpful? Like and Accept a solution. - Donate: Buy coffee ☕- or Paypal me ❤️
- Ryviu - Product Reviews app, collect consumer photo reviews, import reviews from AliExpress, Amazon, Etsy, Shoppe and Walmart and CSV.
- Lookfy app: Create Image Lookbook, Photo Gallery with product hotspots
- Enjoy 3 months of Shopify for $1/month. Sign up now
Hi there
It returned the total cart value before any discounts. For example,
- Total cart value: $400
- Discount: $40
- Total value (final payment amount): $360
So it returned $400.
Basically, I want to make the 'Free Gift' text appear on the packing slip for any orders (before a discount) greater than $350. Somehow, I used other liquid variables such as subtotal_price, order_subtotal_price, etc but they didn't seem to work thus I am trying to use these two variables in the if statement...
Hope this makes sense! Thank you!
So please try to edit your code like this and check again
{% if total_price | minus: discounts_savings >= $350 %}
- Helpful? Like and Accept a solution. - Donate: Buy coffee ☕- or Paypal me ❤️
- Ryviu - Product Reviews app, collect consumer photo reviews, import reviews from AliExpress, Amazon, Etsy, Shoppe and Walmart and CSV.
- Lookfy app: Create Image Lookbook, Photo Gallery with product hotspots
- Enjoy 3 months of Shopify for $1/month. Sign up now
This is an accepted solution.
Hey John,
Liquid if statements can act pretty strange at times with no rhyme or reason.
Try assigning a variable to the filter, and then use that variable inside the if statement instead.
{% assign variable = total_price | minus: discounts_savings %}
{% if variable >= 35000 %}
your code here...
{% endif %}
It might do the trick for you.
Cheers,
I also recommend this
It worked brilliantly! Thank you so much JohnE10!!!
My pleasure. Glad it did the job for you.
User | RANK |
---|---|
44 | |
41 | |
31 | |
24 | |
22 |
Make the shift from discounts to donations, and witness your business not only thrive fina...
By Holly Dec 4, 2023On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023