Skip to main content
Solved

Klaviyo Custom properties

  • April 25, 2024
  • 3 replies
  • 78 views

Forum|alt.badge.img+1
  • Contributor II
  • 3 replies

I am using shopify and Make (instead of Zapier) to write a custom property called MakeOrderCount. The property has number of orders placed by a customer so far. Apparently Klaviyo does not have this information to use in an email.

It works all ok and I do get custom properties populated to each profile. The problem is when I am using them in a logic, it does not work. The code is:

 

{% if person|lookup:'MakeOrderCount' > 199 %}

You are at Level 10, which means you are one of our most loyal customers, someone who has created the most social impact of any customer group. Click on the links to find more about our Social Impact and Levels.

{% elif person|lookup:'MakeOrderCount' == 46 %}

You are at Level 9. You are few orders aways from reaching level 10.

{% else %}

You are on Level 1. You are few orders aways from reaching level 2.

{% endif %}

 

The problem is that it does not matter how many orders a customer has placed. The only line that executes is the first one - saying that you are at level 10.

 

It makes me think that it is a data type problem. The number of orders variable called MakeOrderCount may have 46 stored as a string?

 

Does anyone know how to resolve this.

 

Thanks,

Shaz

Best answer by saulblum

Can you make a test template where you render {% if person %} ? That should give you a dictionary of all the properties, and show whether MakeOrderCount is being stored as a string or number.

If it’s a string, you could try coercing it to a number with one of the float filters, e.g. floatadd

https://developers.klaviyo.com/en/docs/glossary_of_variable_filters#floatadd

{% if person|lookup:'MakeOrderCount'|floatadd:0 > 199 %}

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

3 replies

Forum|alt.badge.img+7
  • Klaviyo Employee
  • 169 replies
  • Answer
  • April 25, 2024

Can you make a test template where you render {% if person %} ? That should give you a dictionary of all the properties, and show whether MakeOrderCount is being stored as a string or number.

If it’s a string, you could try coercing it to a number with one of the float filters, e.g. floatadd

https://developers.klaviyo.com/en/docs/glossary_of_variable_filters#floatadd

{% if person|lookup:'MakeOrderCount'|floatadd:0 > 199 %}


Forum|alt.badge.img+7
  • Klaviyo Employee
  • 169 replies
  • April 25, 2024

That should be {% person %}


Forum|alt.badge.img+1
  • Author
  • Contributor II
  • 3 replies
  • April 25, 2024

I did not know how to make this render, but just added |floatadd:0 like you said and it all worked. Thank you so much @saulblum , you saved the day for me. I can go back home happy now.