How to Show “Only X Points Away” From loyalty reward in Email When Using Custom Property?
Hi everyone! I’m trying to display a dynamic message in an email that shows how many loyalty points a customer needs to unlock their next reward.
For example:
“Only 275 points away from unlocking $10 off!”
I’m storing loyalty points in a custom profile property (e.g. “Joy Loyalty Points”) and would like to subtract that from 2500 directly in the email template.
Page 1 / 1
Thanks for reaching out to the community for help.
Try something like the following - you’ll need to update the code to match your custom profile properties:
{% set points_needed = 2500 - person|lookup:'Joy Loyalty Points' %} You need {{ points_needed }} more points to reach 2500.
Let me know if that works for you!
Thank you for your prompt reply but it didn’t work. It says message displayed without tags or variables. Sorry I’m very new to all this
I’ve been experimenting to try and come up with an answer and haven’t been able to come up with a solution. There are a few posts on the forum that imply this would be possible, but none are working for me when I test:
I’m hoping someone else within the community can point us in the right direction.
Hi @Ai MK ,
Thank you for sharing your query with the community! There have already been some good suggestions shared. Adding to those, here’s one possible solution from my side, hope it helps!
1. Ensure Loyalty Points Are Stored as a Custom Property
First, confirm that each customer's current loyalty points are stored in a custom profile property, such as loyalty_points. This can be achieved through:
Manual Updates: Editing individual profiles to add the loyalty_points property.
CSV Imports: Uploading a CSV file with the loyalty_points column.
Integrations: Using loyalty platforms like Smile.io or LoyaltyLion to sync points automatically.
API Calls: Utilizing Klaviyo’s Identify or Profiles API to update properties in real-time.
2. Determine the Reward Threshold
Decide the number of points required to unlock the next reward. For example, if a $10 discount requires 500 points, then:
{% assign reward_threshold = 500 %}
3. Calculate Points Needed
Subtract the customer's current points from the reward threshold:
People need to reach 2500 points to be eligible for a reward, so we need to display how many more points they need to reach that number.
Let’s say we have 2000 points. We need 500 more points to get a reward. By using the filter |multiply:”-1”, we first turn the number into a negative number. Now we have -2000.
After this, we need to add 2500. We do this with |floatadd:2500. -2000+2500 is 500. It’ll now display 500.0 points!
We end with |floatformat:0 to get rid of that decimal point.
I tested this in my test account, and it managed to work. Take a look:
This should work for you! Give it a try, and let me know if it works, or if you have any questions.