Skip to main content
Problem Solver I
February 16, 2024
Solved

Catalog lookup: Before and after price

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

    This topic has been closed for replies.
    MathildeAnswer
    Problem Solver I
    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 %}

    2 replies

    MathildeAuthorAnswer
    Problem Solver I
    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
    Klaviyo Alum
    March 21, 2024

    Hi @Mathilde!

    Thanks for sharing your solution with the Community!

    Best,
    Brian