Solved

Klaviyo Custom properties

  • 25 April 2024
  • 3 replies
  • 22 views

Badge +1

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

icon

Best answer by saulblum 25 April 2024, 17:05

View original

3 replies

Userlevel 4
Badge +7

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

Userlevel 4
Badge +7

That should be {% person %}

Badge +1

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. 

Reply