Making a text appear on packing slip using a pre-discount cart/order value

John_jmk
Excursionist
22 0 5

Hi Community!

 

I have a question that may be quite simple for the experts.

 

Basically, I want to make the 'You've just earned a Free Gift!' text appear on the packing slip for orders whose cart value is greater than $350 before any discount. Basically, as long as the cart value (not the final total value) is more than $350, then the text appears on the packing slip.

 

I've tried to use just one liquid variable such as {{ subtotal_price }} or {{ cart.subtotal.price }} but it didn't seem to work...So I worked around it by using the total price - discounts as per my example.

 

Is there anything you can advise for me to be able to make the free gift text appear on the packing slip for the orders whose before-discount value is greater than $350?

 

Any advice will be greatly appreciated.

 

{% if total_price  | minus: discounts_savings >=35000 %}

<p style="padding-top: 10px;">You've just earned a FREE Secret Gift! </p>

{% endif %}

 

Replies 7 (7)

saad13
Excursionist
10 1 0

Hi check with this 

{% if order.subtotal_price > 350 %}
John_jmk
Excursionist
22 0 5

Hi Saad13

 

Thanks for your reply. Unfortunately, it doesn't seem to be working...

 

So, I've put the below to see if I get any value on the packing slip and there was no returning value.

 

<p>order subtotal price: {{ order.subtotal_price }}</p>

 

John_jmk_1-1696919374068.png

 

If you have any other advice, that'll be greatly appreciated. Thanks!

 

saad13
Excursionist
10 1 0

{% if total_price - discounts_savings >= 35000 %} <p style="padding-top: 10px;">You've just earned a FREE Secret Gift! </p> {% endif %} try this make sure that you've properly defined and calculated the total_price and discounts_savings

saad13
Excursionist
10 1 0

you can also try this

{% assign discounts_savings = 0 %}
{% for discount_allocation in order.discount_allocations %}
{% assign discounts_savings = discounts_savings | plus: discount_allocation.amount %}
{% endfor %}

{% if order.total_price - discounts_savings >= 35000 %}
<p style="padding-top: 10px;">You've just earned a FREE Secret Gift! </p>
{% endif %}

John_jmk
Excursionist
22 0 5

I've also tried this but "<p style="padding-top: 10px;">You've just earned a FREE Secret Gift! </p>" didn't show at all even for eligible orders. So I assume that the calculations part didn't work unfortunately.

John_jmk
Excursionist
22 0 5

Hi Saad13

 

When I put {{ total_price | minus: discounts_savings }}, it returns a correct value.

 

So unless there is one simple liquid variable, the key is how to put that into the if statement...

 

Any ideas?

 

 

{% if total_price  | minus: discounts_savings >=35000 %}

 

John_jmk
Excursionist
22 0 5

Thank you Saad13. But this didn't work 😞