Skip to main content
Solved

Catalog lookup: Before and after price


Forum|alt.badge.img+6

Hi there :)

 

Can someone help with this?

 

I’ve been following this recipe for setting up Simplified Custom Product Blocks: https://medium.com/klaviyo-developers/simplified-custom-product-blocks-b22e53d21bf6

However, I’m not having luck with my before and after prices.

 

This is what I have done:

Button: {% if catalog_item.metadata|lookup:"default_price" != None %} Nu {% currency_format catalog_item.metadata|lookup:"$price" %}{% else %} {% currency_format catalog_item.metadata|lookup:"$price" %} {% endif %}

What I want:

  • If discounted price: Nu xxx kr.
  • If not discounted price: xxx kr.

However, I see this one no matter what: Nu xxx kr.

 

Below the button: {% if catalog_item.metadata|lookup:"default_price" != None %}<s> {% currency_format catalog_item.metadata|lookup:"default_price" %} </s>{% endif %}

What I want:

  • If discounted price: Price with a strike through
  • If not discounted price: Nothing showed

However, I see this one no matter what: Price with a strike through

 

Best,

Mathilde

Best answer by Mathilde

Hi!

If anybody else sees my question and is missing the solution, then here it is:

Button: {% if catalog_item.metadata|lookup:"default_price" != catalog_item.metadata|lookup:"$price" %} Now {% currency_format catalog_item.metadata|lookup:"$price" %}{% else %} {% currency_format catalog_item.metadata|lookup:"$price" %} {% endif %}

 

Below the button: {% if catalog_item.metadata|lookup:"$price" != catalog_item.metadata|lookup:"default_price" %}<s> {% currency_format catalog_item.metadata|lookup:"default_price" %} </s>{% endif %}

View original
Did this topic or the replies in the thread help you find an answer to your question?

2 replies

Forum|alt.badge.img+6
  • Author
  • Problem Solver I
  • 28 replies
  • Answer
  • February 17, 2024

Hi!

If anybody else sees my question and is missing the solution, then here it is:

Button: {% if catalog_item.metadata|lookup:"default_price" != catalog_item.metadata|lookup:"$price" %} Now {% currency_format catalog_item.metadata|lookup:"$price" %}{% else %} {% currency_format catalog_item.metadata|lookup:"$price" %} {% endif %}

 

Below the button: {% if catalog_item.metadata|lookup:"$price" != catalog_item.metadata|lookup:"default_price" %}<s> {% currency_format catalog_item.metadata|lookup:"default_price" %} </s>{% endif %}


Brian Turcotte
Forum|alt.badge.img+37

Hi @Mathilde!

Thanks for sharing your solution with the Community!

Best,
Brian