Skip to content

Metafields Reference

Complete catalog of every Shopify metafield used in UberLotto v2. Organized by scope (product, variant, page, shop) with namespace, key, type, and purpose.

Product-Level Metafields

These metafields are set on individual Shopify products.

NamespaceKeyFull ReferenceTypeRequiredDescription
customgame_slugcustom.game_slugSingle line textYesUnique slug linking to Supabase data (e.g., powerball)
customgame_db_namecustom.game_db_nameSingle line textNoLegacy/unused. Stores Supabase game name but is not consumed by application logic. game_slug is the primary identifier.
customdraw_games_schedulecustom.draw_games_scheduleSingle line textYesDrawing days (e.g., Mon, Wed, Sat)
customlottery_pool_cutoff_timecustom.lottery_pool_cutoff_timeSingle line textYesEntry cutoff in 24h format (e.g., 22:00)
customlogo_imagecustom.logo_imageFile referenceNoCustom logo for game cards
customlottery_ticket_multipliercustom.lottery_ticket_multiplierSingle line textNoEnables multiplier display (true/false)
customenable_play_optionscustom.enable_play_optionsSingle line textNoEnables play options UI (true/false)
customdisabled_dayscustom.disabled_daysJSONNoDays game is unavailable (e.g., ["Sun"])

GraphQL Query

All product metafields are fetched in app/graphql/game-detail/GameDetailQuery.ts:

graphql
product(handle: $handle) {
  gameSlug: metafield(namespace: "custom", key: "game_slug") { value }
  gameDbName: metafield(namespace: "custom", key: "game_db_name") { value }  # Queried but unused
  drawGamesSchedule: metafield(namespace: "custom", key: "draw_games_schedule") { value }
  lotteryPoolCutoffTime: metafield(namespace: "custom", key: "lottery_pool_cutoff_time") { value }
  logoImage: metafield(namespace: "custom", key: "logo_image") {
    reference {
      ... on MediaImage {
        image { url }
      }
    }
  }
  lotteryTicketMultiplier: metafield(namespace: "custom", key: "lottery_ticket_multiplier") { value }
  enablePlayOptions: metafield(namespace: "custom", key: "enable_play_options") { value }
  enabledDays: metafield(namespace: "custom", key: "disabled_days") { value }
}

TIP

The game_slug metafield is the only identifier that connects Shopify products to Supabase data. It replaced an earlier game_type numeric ID system.

Variant-Level Metafields

These metafields are set on individual product variants and control per-variant quantity limits.

NamespaceKeyFull ReferenceTypeStatusDescription
cartmax_quantitycart.max_quantityIntegerCurrentMaximum quantity per cart for this variant
limitsmax_quantitylimits.max_quantityIntegerLegacyLegacy max quantity (fallback only)

Priority Chain

When determining the max quantity for a variant, the system checks in this order:

  1. Shopify native quantityRule (highest priority) — Set in variant inventory settings
  2. cart.max_quantity metafield — Current namespace
  3. limits.max_quantity metafield — Legacy fallback

GraphQL Query

graphql
variants(first: 250) {
  nodes {
    quantityRule {
      maximum
      minimum
      increment
    }
    maxQuantity: metafield(namespace: "cart", key: "max_quantity") {
      value
      type
    }
    legacyMaxQuantity: metafield(namespace: "limits", key: "max_quantity") {
      value
      type
    }
  }
}

Page-Level Metafields (Home Page)

These metafields are set on the Shopify Page with handle home and control home page behavior.

NamespaceKeyFull ReferenceTypeDescription
custombannercustom.bannerJSONBanner configuration data (title, message, link, etc.)
customproduct_limitcustom.product_limitSingle line textNumber of products to display on home page
customlottery_collection_idcustom.lottery_collection_idSingle line textOverride the default lottery collection ID

GraphQL Query

Fetched in app/routes/($locale)._index.tsx:

graphql
page(handle: "home") {
  banner: metafield(namespace: "custom", key: "banner") { value }
  productLimit: metafield(namespace: "custom", key: "product_limit") { value }
  lotteryCollectionId: metafield(namespace: "custom", key: "lottery_collection_id") { value }
}

Defaults

SettingDefaultDefined In
Product limit10 (range: 1–250)app/lib/settings.ts
Collection IDgid://shopify/Collection/429088702676app/lib/settings.ts
Bannernull (no banner)

The parseProductLimit() and parseCollectionId() functions in app/lib/settings.ts handle validation and fallback to defaults.

Shop-Level Metafields

These metafields are set on the Shopify Shop object and define global quantity limits. See Quantity Limits for full details.

Current Namespace (cart.*)

NamespaceKeyFull ReferenceTypeDescription
cartmax_quantity_globalcart.max_quantity_globalIntegerGlobal max quantity across all product types
cartmax_quantity_lotterycart.max_quantity_lotteryIntegerMax quantity for lottery products
cartmax_quantity_scratch_cardcart.max_quantity_scratch_cardIntegerMax quantity for scratch card products
cartmax_quantity_gamecart.max_quantity_gameIntegerMax quantity for game products

Legacy Namespace (limits.*)

NamespaceKeyFull ReferenceTypeStatus
limitsglobal_limitlimits.global_limitIntegerLegacy fallback
limitslottery_limitlimits.lottery_limitIntegerLegacy fallback
limitsscratch_card_limitlimits.scratch_card_limitIntegerLegacy fallback
limitsgame_limitlimits.game_limitIntegerLegacy fallback

Fallback Chain

For each product type, the system tries the cart.* metafield first, then falls back to limits.*:

cart.max_quantity_lottery  →  limits.lottery_limit  →  cart.max_quantity_global  →  limits.global_limit

Implementation: app/lib/shop-limits.server.ts

Customer Account Metafields

NamespaceKeyFull ReferenceTypeDescription
favoritesproductsfavorites.productsJSONCustomer's favorited product IDs

Complete Metafield Map

Summary of all metafields by scope:

ScopeCountNamespaces Used
Product8custom
Variant2cart, limits
Page (Home)3custom
Shop8cart, limits
Customer1favorites
Total22

WARNING

When creating metafield definitions in Shopify Admin, ensure the namespace and key match exactly. Metafields are case-sensitive.

UberLotto Technical Documentation