Skip to main content
Solved

Catalog lookup: Before and after price

  • February 16, 2024
  • 2 replies
  • 141 views

Forum|alt.badge.img+7

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 %}

2 replies

Forum|alt.badge.img+7
  • Author
  • Problem Solver I
  • 34 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
  • Klaviyo Alum
  • 1393 replies
  • March 21, 2024

Hi @Mathilde!

Thanks for sharing your solution with the Community!

Best,
Brian