I’m looking for the variable code to show the total number of points a user has with my store. Ideally if they have no points we could then prompt them to sign up for points instead.
Closest code I can come up with is: {% if points_total %}{{ points_total }}, {% endif %} but it doesn’t seem to work very well when I test it. Klaviyo does keep track of points under user profiles so this should be possible.
Thank you for sharing your question with the Klaviyo Community.
Your best bet is to create two discrete text blocks, the first with the following verbiage: Your points total is {{ person|lookup:'points_total'|default:'' }} using the question mark symbol option on the text block for hide/show with the condition: person|lookup:'points_total'. That’s saying to display this block only if the points total is set on the profile.
On the flip side, we’ll want to create another discrete text block with the verbiage: “Sign up here” (hyperlinking the sign-up page) using the question mark symbol option on the text block for hide/show with the condition: not person|lookup:'points_total' That’s saying to display this block only if the points total is not set on the profile.
So block A will only show if the points total is available (showing the points total) and block B will only show if the points total is not on the profile linking them to the sign-up page.
There was a great post made by @retention on this topic (sharing that below as well)
Thank you for sharing your question with the Klaviyo Community.
Your best bet is to create two discrete text blocks, the first with the following verbiage: Your points total is {{ person|lookup:'points_total'|default:'' }} using the question mark symbol option on the text block for hide/show with the condition: person|lookup:'points_total'. That’s saying to display this block only if the points total is set on the profile.
On the flip side, we’ll want to create another discrete text block with the verbiage: “Sign up here” (hyperlinking the sign-up page) using the question mark symbol option on the text block for hide/show with the condition: not person|lookup:'points_total' That’s saying to display this block only if the points total is not set on the profile.
So block A will only show if the points total is available (showing the points total) and block B will only show if the points total is not on the profile linking them to the sign-up page.
There was a great post made by @retention on this topic (sharing that below as well)