Sale indicator Graphic if price less than regular price

Using the the get product snippet with placeholders, as well as using [[+product.price_rendered]] I am trying to display a sale indicator graphic using the following:

[[+product.price:lt=`[[+product.regular_price]]`:then=`Sales Graphic`]]

However ‘Sales Graphic’ is always displayed.

Anyone got any other ideas to solve what I am trying to achieve?

Does [[+product.price_rendered]] not give what you need?

In a way yes. However, I just want to embellish the fact a product is on sale with graphic flash in a different area of the HTM. Or can I use &tpl?

There’s a template, frontend/price.twig, that you can override in your theme to change how it renders. That globally changes the price rendering though, and can’t be changed for specific uses.

Thanks @mhamstra that was the route I was going to try. May play around with CSS pseudo.

BTW, simply using the placeholder uncached was problem solved :grinning:

  `[[!+product.price:lt=`[[!+product.regular_price]]`:then=`Sales Graphic`]]`
1 Like