Liquid API
wishlist
Access the customer's wishlist items as an array of product variant references.
Syntax
customer.metafields.lantern.wishlistDescription
The wishlist metafield contains an array of product variant GIDs (Global IDs) that the customer has added to their wishlist. This is automatically updated when customers add or remove items from their wishlist through the loyalty program.
The wishlist metafield contains a JSON array of Shopify product variant GIDs that must be parsed using Liquid's parse_json filter before accessing.
Properties
Type: JSON Array
Namespace: lantern
Return Values
| Scenario | Value | Type |
|---|---|---|
| Customer has wishlist items | Array of variant GIDs | JSON Array |
| Customer has empty wishlist | [] (empty array) | JSON Array |
| Logged out | null | null |
Array Structure
The wishlist is an array of Shopify product variant Global IDs:
Prop
Type
Examples
Basic Wishlist Display
{% assign wishlist_data = customer.metafields.lantern.wishlist %}
{% if wishlist_data %}
{% assign wishlist_gids = wishlist_data | parse_json %}
{% if wishlist_gids.size > 0 %}
<div class="wishlist-count">
{{ wishlist_gids.size }} item{% unless wishlist_gids.size == 1 %}s{% endunless %} in wishlist
</div>
{% endif %}
{% endif %}Check if Product is in Wishlist
{% assign wishlist_data = customer.metafields.lantern.wishlist %}
{% if wishlist_data %}
{% assign wishlist_gids = wishlist_data | parse_json %}
{% assign current_variant_gid = 'gid://shopify/ProductVariant/' | append: product.selected_or_first_available_variant.id %}
{% if wishlist_gids contains current_variant_gid %}
<button class="wishlist-btn active">♥ Remove from Wishlist</button>
{% else %}
<button class="wishlist-btn">♡ Add to Wishlist</button>
{% endif %}
{% endif %}