LoyaltyLion can push customer properties to Shopify customer metafields when a customer changes. For example, when a customer earns points we can update a metafield on the corresponding customer resource in Shopify.
Metafields can be accessed in Liquid templates as well as from the API, which enables some powerful integrations and custom interfaces.
Shopify metafield sync is available on our Classic plan and above. Contact support@loyaltylion.com to get it turned on for your account and tell us which metafields you'd like us to sync.
Available LoyaltyLion fields
The following fields can be pushed as customer metafields. You can enable or disable the exact metafields we'll push from the Integrations section of the LoyaltyLion admin.
A maximum of 3 can be selected from the below due to Shopify's API rate limit - for more information, see "Rate limits" below.
Description - Example - Metafield name
Total points - 1000 - loyaltylion.points_total
Approved points - 800 - loyaltylion.points_approved
Pending points - 200 - loyaltylion.points_pending
Lifetime points - 2000 - loyaltylion.points_lifetime
Spent points - 1000 - loyaltylion.points_spent
Number of rewards claimed - 3 - loyaltylion.rewards_claimed
Date enrolled in program (YYYY-MM-DD) - 2017-09-20 - loyaltylion.enroll_date
Referral URL - http://prz.io/KzByQ2Fa - loyaltylion.referral_url
Loyalty Tier name - Silver - loyaltylion.loyalty_tier
Birthday (YYYY-MM-DD) - 1970-03-15 - loyaltylion.birthday
---------------------------------------
Using metafields
Within Liquid templates
You can reference metafields in most Liquid templates like so:
#{{ customer.metafields.loyaltylion.points_total }}
For example, to display the customer's unique referral link:
referral url: #{{ customer.metafields.loyaltylion.points_total }}
----------------------------------------
Caveats
Although we generally sync metafields straight away, usually within a few minutes of a customer changing in LoyaltyLion, the sync can be delayed, particularly if many customers change at once, due to Shopify API rate limit restrictions.
If you're using metafields in an integration or in a template, you should account for their values being slightly out of date, or, in the case of new customers, blank.
Rate limits
Shopify has a strict API rate limit, and the quota is shared between all LoyaltyLion functionality.
In order to work within this budget and preserve resources for time sensitive interactions - such as your customers claiming rewards - the Metafield integration is subject to strict constraints.
Although we generally sync metafields straight away, usually within a few minutes of a customer changing in LoyaltyLion, the sync can be delayed, particularly if many customers change at once, due to Shopify API rate limit restrictions.
If you're using metafields in an integration or in a template, you should account for their values being slightly out of date, or, in the case of new customers, blank.