> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lantern.is/llms.txt
> Use this file to discover all available pages before exploring further.

# 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](https://help.shopify.com/en/manual/custom-data/) using [metafields](https://help.shopify.com/en/manual/custom-data/metafields) and [metaobjects](https://help.shopify.com/en/manual/custom-data/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](https://shopify.dev/docs/api/liquid/objects/metafield).

<Info>
  For comprehensive guides and code examples, see our [Liquid API documentation](/docs/storefront/liquid-api).
</Info>

## 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`](/docs/storefront/liquid-api/activity-feed) | Recent customer activity events                      | Loyalty actions, purchases, referrals                                |
| [`birth_date`](/docs/storefront/liquid-api/birth-date)       | Customer's birthday. On `facts` instead of `lantern` | `"1989-12-13"`                                                       |
| [`is_tester`](/docs/storefront/liquid-api/is-tester)         | Test account flag                                    | Hide from analytics, enable debug features                           |
| [`properties`](/docs/storefront/liquid-api/properties)       | Custom customer properties                           | `{"favorite_category": "electronics"}`                               |
| [`wallet`](/docs/storefront/liquid-api/wallet)               | All available rewards & credits                      | Active discounts, gift cards, product rewards, store credit balances |
| [`wishlist`](/docs/storefront/liquid-api/wishlist)           | Customer's wishlist items                            | Array of product variant GIDs                                        |

### Loyalty Program

| Field                                                          | Description                | Example Value |
| -------------------------------------------------------------- | -------------------------- | ------------- |
| [`loyalty_tier`](/docs/storefront/liquid-api/loyalty-tier)     | Current tier name          | `"Gold"`      |
| [`loyalty_points`](/docs/storefront/liquid-api/loyalty-points) | Available points balance   | `1250`        |
| [`loyalty_spend`](/docs/storefront/liquid-api/loyalty-spend)   | Current period spend       | `249.99`      |
| [`is_eligible`](/docs/storefront/liquid-api/is-eligible)       | Can participate in loyalty | `true`        |
| [`is_blocked`](/docs/storefront/liquid-api/is-blocked)         | Blocked from rewards       | `false`       |

### Referral Program

| Field                                                        | Description             | Example Value   |
| ------------------------------------------------------------ | ----------------------- | --------------- |
| [`referral_code`](/docs/storefront/liquid-api/referral-code) | Unique referral code    | `"6b577dd5288"` |
| [`is_advocate`](/docs/storefront/liquid-api/is-advocate)     | Has referred others     | `true`          |
| [`is_referred`](/docs/storefront/liquid-api/is-referred)     | Joined through referral | `true`          |

## Quick Start Examples

### Show Loyalty Status

```liquid theme={null}
{% 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

```liquid theme={null}
{% 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

```liquid theme={null}
{% 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

```liquid theme={null}
{% 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

```liquid theme={null}
{% 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

```liquid theme={null}
{% 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

```liquid theme={null}
{% 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 %}
```
