Ayra writes its customer-, product- and order-level state to Shopify metafields in the ayra namespace and defines a small set of ayra_* metaobjects, so a theme, a Shopify segment, Shopify Email or another app can read a balance, a tier, a lifecycle stage, a product rating or an order’s attribution without calling Ayra. Definitions are created at install with the app as owner, which means they are visible in the admin’s metafield settings, readable from Liquid and the Storefront API, and removed by Shopify when the app is uninstalled.
Access: storefront read access is granted on everything a theme block needs; admin API read for all; write is Ayra only.
Money values are JSON { amount, currencyCode } in the shop currency. Dates are ISO 8601.
Shopify’s standard reviews.rating and reviews.rating_count product metafields are written in addition to ayra.*, because Shopify and other apps already read them.
{%- if customer -%} {%- assign wallet = customer.metafields.ayra.wallet_balance.value -%} {%- if wallet -%} <p>You have {{ wallet.points }} points and {{ wallet.storeCredit | money }} in store credit.</p> {%- endif -%} {%- if customer.metafields.ayra.tier -%} <span class="tier">{{ customer.metafields.ayra.tier }}</span> {%- endif -%}{%- endif -%}{%- assign summary = product.metafields.ayra.review_summary.value -%}{%- if summary and summary.count > 0 -%} <span>{{ summary.average }} / 5 · {{ summary.count }} reviews</span>{%- endif -%}
Customer metafields are readable in Liquid for the logged-in customer only. For anonymous visitors use the blocks, which fetch wallet state through the app embed after identification.