FROM CACHE - en_header

Code error (Im a newby)

New Member
1 0 0

Hi team. I am trying to add a condition that if a product price or variant is at $0.00, text saying "Coming Soon!" is displayed. 


I am using the latest Debut theme and have followed a few threads. I think I am close, but keep getting an error.

This file contains the following errors:

  • Line 25 — Liquid syntax error: Unknown tag '{%endif'

Here is the code I have changed in the product.price liquid snippet. I am REALLY new to coding, so any assistance would be awesome.







Reply 1 (1)
Shopify Expert
10959 196 2213

Hi Jason!

You are pretty close to the solution but there's a few mistakes made. I'll try and break this down into parts first. There's a quick solution but I'm mindful to just not give you the answer without trying to nudge you there first. If you do get stuck that's ok.


Part 1: Liquid tags

What has tripped you up is that there is a surrounding {%- liquid -%} tag. You'll notice that Liquid within that tag doesn't need the braces anymore. Notice how the lines above don't have those?
Take your {%endif%} and just make it endif.

well really it should be made...




...since that will close the Liquid tag properly (see part 3 below)


Part 2: Logic statement is broken

You've added your code into an existing logic block (being the if statement). It reads as:

  • if
  • else
  • if
  • else
  • endif

That's not a valid flow.


Part 3: Liquid Tag isn't closed.

Now that {% endif %} could have tripped you up here too but it does need a %} to close it off properly


Part 4: Money vs a string

Warning only. Do note that some themes will expect the price to be an actual price vs some other string. Not sure what your theme will do but it's possible something will break. Try it and see!


If you need to see the complete code just pop a reply and I'll give it. Since I am a little lazy (efficient) it would help if you pasted the code instead of that screenshot so it's easier for me to tweak.

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. ★