Accessing Lantern Data
Learn how to access Lantern data through metafields and metaobjects
Lantern continuously stores and updates all of the data it collects in Shopify as Custom Data using metafields and metaobjects. We use this data to build all of our storefront extensions so your store loads as quickly as possible. If you want to build custom experiences using Liquid, you can reference them the same way.
Learn more about accessing metafields in your Liquid code on Shopify.
For comprehensive guides and code examples, see our Liquid API documentation.
Available Customer Metafields
All metafields use the lantern.customer namespace unless noted otherwise and are automatically updated by Lantern:
Customer Profile
| Field | Description | Example |
|---|---|---|
activity_feed | Recent customer activity events | Loyalty actions, purchases, referrals |
birth_date | Customer's birthday. On facts instead of lantern | "1989-12-13" |
is_tester | Test account flag | Hide from analytics, enable debug features |
properties | Custom customer properties | {"favorite_category": "electronics"} |
wallet | All available rewards & credits | Active discounts, gift cards, product rewards, store credit balances |
wishlist | Customer's wishlist items | Array of product variant GIDs |
Loyalty Program
| Field | Description | Example Value |
|---|---|---|
loyalty_tier | Current tier name | "Gold" |
loyalty_points | Available points balance | 1250 |
loyalty_spend | Current period spend | 249.99 |
is_eligible | Can participate in loyalty | true |
is_blocked | Blocked from rewards | false |
Referral Program
| Field | Description | Example Value |
|---|---|---|
referral_code | Unique referral code | "6b577dd5288" |
is_advocate | Has referred others | true |
is_referred | Joined through referral | true |
Quick Start Examples
Show Loyalty Status
{% assign points = customer.metafields.lantern.loyalty_points %}
{% assign tier = customer.metafields.lantern.loyalty_tier %}
{% if points and tier %}
<div class="loyalty-status">
<h3>Welcome {{ tier }} Member!</h3>
<p>You have <strong>{{ points }} points</strong> available</p>
</div>
{% endif %}Display Referral Code
{% assign ref_code = customer.metafields.lantern.referral_code %}
{% if ref_code %}
<div class="referral-share">
<p>Share your code: <code>{{ ref_code }}</code></p>
<p>Friends get rewards, you get rewards!</p>
</div>
{% endif %}Show Available Rewards Count
{% assign wallet = customer.metafields.lantern.wallet | parse_json %}
{% if wallet.items.size > 0 %}
<div class="rewards-available">
<p>You have <strong>{{ wallet.items.size }} rewards</strong> ready to use!</p>
<a href="/account/rewards">View My Rewards</a>
</div>
{% endif %}Check Store Credit Balance
{% assign wallet = customer.metafields.lantern.wallet | parse_json %}
{% if wallet.storeCreditAccounts.size > 0 %}
{% assign total_credit = 0 %}
{% for account in wallet.storeCreditAccounts %}
{% assign credit = account.balance.amount | plus: 0 %}
{% assign total_credit = total_credit | plus: credit %}
{% endfor %}
<div class="store-credit">
<p>Store Credit: <strong>${{ total_credit }}</strong></p>
</div>
{% endif %}Display Wishlist Count
{% assign wishlist = customer.metafields.lantern.wishlist | parse_json %}
{% if wishlist.size > 0 %}
<div class="wishlist-status">
<p>You have <strong>{{ wishlist.size }} items</strong> in your wishlist</p>
<a href="/pages/wishlist">View Wishlist</a>
</div>
{% endif %}Show Custom Properties
{% assign properties = customer.metafields.lantern.properties | parse_json %}
{% if properties.favorite_category %}
<div class="personalized-content">
<p>Based on your interest in <strong>{{ properties.favorite_category }}</strong>:</p>
<!-- Show personalized content -->
</div>
{% endif %}Display Recent Activity
{% assign activity = customer.metafields.lantern.activity_feed | parse_json %}
{% if activity.events.size > 0 %}
<div class="recent-activity">
<h4>Recent Activity</h4>
{% for event in activity.events limit: 3 %}
<p>{{ event.metric.name }} - {{ event.timestamp | date: '%B %d' }}</p>
{% endfor %}
</div>
{% endif %}