Skip to content
Ayra Docs

Metafields & metaobjects reference

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.

  • Namespace ayra for metafields; definition names prefixed ayra_ for metaobjects.
  • Owner types: customer, product, variant, order, shop.
  • 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.
KeyTypeWritten byNotes
ayra.wallet_balancejsonLoyalty{ total, points, storeCredit, vouchers } in shop currency; the Smart Wallet view
ayra.points_balancenumber_integerLoyaltyPoints only, for Liquid and segments
ayra.store_credit_balancemoneyLoyaltyMirrors Shopify store credit for convenience
ayra.tiersingle_line_text_fieldLoyaltyCurrent tier name; empty when tiers are off
ayra.tier_progressjsonLoyalty{ tier, nextTier, progress, remaining, basis }
ayra.points_expiringjsonLoyalty{ points, expiresAt } for the next expiry batch
ayra.referral_codesingle_line_text_fieldReferralsStable code shown in the hub
ayra.referral_urlurlReferralsCanonical share link
ayra.referralsjsonReferrals{ invited, pending, granted } counts
ayra.lifecycle_stagesingle_line_text_fieldSegmentationnew, active, at_risk, lapsed, won_back
ayra.segmentslist.single_line_text_fieldSegmentationSegment handles the customer is in
ayra.intent_scorenumber_decimalWishlist (later)0–1
ayra.ltvmoneyAnalyticsLifetime revenue after refunds
ayra.open_issuebooleanTrust RecoveryTrue while a support issue is open
ayra.wishlistjsonWishlist (later)[{ variantId, addedAt }]
ayra.preferred_channelsingle_line_text_fieldJourney Guardemail, sms, whatsapp, push
KeyOwnerTypeWritten byNotes
reviews.ratingproductratingReviews (later)Shopify standard; { scale_min: 1, scale_max: 5, value }
reviews.rating_countproductnumber_integerReviews (later)Shopify standard
ayra.review_summaryproductjsonReviews (later){ average, count, distribution, mediaCount, lastPublishedAt }
ayra.qa_countproductnumber_integerReviews (later)Answered questions
ayra.wishlist_countvariantnumber_integerWishlist (later)For “N people want this” blocks
ayra.restock_subscribersvariantnumber_integerBack in Stock (later)Registrations waiting
ayra.preordervariantjsonPre-Order (later){ enabled, expectedShipDate, limit, sellingPlanId }
KeyTypeWritten byNotes
ayra.attributionjsonAnalytics{ module, opportunityType, actionId, channel, window } or { module: null }; single-touch (Revenue Truth)
ayra.referraljsonReferrals{ referrerId, code, status } on referred orders
ayra.redemptionjsonLoyalty{ points, storeCredit, vouchers, ledgerIds } applied at checkout
ayra.points_earnednumber_integerLoyaltyPoints this order earned once paid
KeyTypeNotes
ayra.settings_publicjsonWhat blocks need before a customer is identified: points label, currency display, earn ratio, tiers list
ayra.modulesjsonWhich modules are on, so a theme can hide blocks for modules that are off
DefinitionFieldsWritten byNotes
ayra_reviewproduct (product reference), customer (customer reference, optional), rating (integer), title, body, media (list.file_reference), verified (boolean), status (published/unpublished), reply, reply_at, published_at, source (ayra/import:judge-me/…)Reviews (later)One entry per review, so themes can render reviews with Liquid and no block
ayra_questionproduct, customer (optional), question, answer, answered_by, answered_at, statusReviews (later)Q&A threads
ayra_tiername, handle, threshold_type (spend/points), threshold (number), perks (json), badge (file_reference, optional), positionLoyaltyTier definitions readable by themes
ayra_rewardhandle, name, type (store_credit/points/voucher/percent), value, cost_points, expires_days, statusLoyaltyThe reward catalogue shown in the hub
ayra_earn_rulehandle, name, event, points, ratio, enabledLoyaltySo a “how to earn” block can be pure Liquid
ayra_opportunity_typehandle, name, priority, description, expiry_hoursEngineRead-only catalogue of opportunity types for reporting apps
{%- 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.

Something missing or wrong on this page? Ask us and we will fix the docs.