# Global context

Store identity, routes, localization, navigation, consent, the age gate, and request state.

These pages list the exact data fields available to hosted Vascula themes. Add a root name such as `product` to a section's `ctx_needs`, then read it directly as `product.title` in the template. The `ctx.` prefix shown here identifies the public contract; do not include that prefix in a Vascula expression. Required fields are present whenever their containing object is present. Optional fields may be absent, and nullable fields may be present as null. `[]` marks an array item and `{key}` marks a key selected at runtime. Named types such as Price and Media are detailed on Shared data shapes.

## ctx.shop

Store identity, storefront-visible store metafields, the active market's standing free-shipping offer, and the storefront search switches. Available on every storefront route. Declare it in `ctx_needs` before reading it.

| Field | Type | Requirement | Description |
| --- | --- | --- | --- |
| `ctx.shop` | Object | Declared root |  |
| `ctx.shop.checkout_enabled` | Boolean | Optional | False when this storefront sells by enquiry only (the sales channel's selling mode in Store Admin): there is no cart, checkout, buy now, express checkout or Gift Card purchase, and every product is on_request with availability_reason enquiries_only while keeping its price. Hide the cart icon, cart drawer, cart and checkout links and cart forms then; show prices and an enquiry (the product page's contact form or the store's own link) instead of add to cart. The platform refuses every cart and checkout request on such a storefront. |
| `ctx.shop.contact_email` | String | Optional |  |
| `ctx.shop.free_shipping` | Object | Optional |  |
| `ctx.shop.free_shipping.rate_below` | Money input | Required |  |
| `ctx.shop.free_shipping.threshold` | Money input | Required |  |
| `ctx.shop.live_chat` | Object | Optional | The storefront Live Chat: whether to show the theme's chat block, its welcome message, and the platform script and endpoints that run it. The theme designs the chat; the platform runs it. |
| `ctx.shop.live_chat.ai_assistant` | Boolean | Required | True when the AI Sales Assistant answers in the chat. With team and ai_assistant both true, open the chat on the assistant and show a switcher at the top to chat with the team instead (TringifyChat.setMode("ai" \| "team")). With only ai_assistant, there is no switcher: when the assistant can't help it hands over to the team, who follow up by email (a case). |
| `ctx.shop.live_chat.api_url` | String | Required | The Live Chat endpoints on this store domain (/api/shop/2026-11/chat): config, challenge, start, messages, email, attachments and socket, for a chat built without the script. |
| `ctx.shop.live_chat.enabled` | Boolean | Required | True when the chat is available: the store's plan includes Live Chat and the store has its team (team) or the AI Sales Assistant (ai_assistant) on, in Inbox › Live Chat settings. Show the chat block only while true; the chat itself checks again when it starts, so a page cached before the merchant turned it off starts no chat. |
| `ctx.shop.live_chat.script_url` | String | Required | The Live Chat script (versioned, no styling). Load it once with <script src defer>; it defines window.TringifyChat: start, send, setEmail, typing, history, mode/setMode("ai" \| "team"), setContext({product, cart}) (tells the assistant the product and cart the page shows), addToCart(product_id, variant_id, quantity) and on(event) for message, typing, online, mode, action and error. Assistant messages may carry cards (product_id, title, url, image, price, compare_at, available, variants): draw them with a variant picker and an Add button (addToCart). Actions: open_product, apply_filter, add_to_cart and checkout (Buy now: the shopper taps, then confirm() opens checkout); set handlers.add_to_cart to add to the theme's cart. Voice (config.voice, Pro plans): talk() starts a call, stopTalking() ends it; the voice event reports connecting, listening and ended, and every connecting ends with one ended. ended carries a reason: stopped, time_limit (5-minute cap), credits, handover, safety_check, shopper_left, voice_unavailable, voice_busy, team_answering, model_closed, model_error, microphone (refused or none), start_failed, audio_failed, connection_lost; word the ones that need it and use a general message for the rest. Whether staff are online is live (TringifyChat.online and the online event), never part of the page, because pages are cached. |
| `ctx.shop.live_chat.team` | Boolean | Required | True when shoppers can chat with the store's team (Live Chat on). Whether someone is online right now is live (TringifyChat.online), never part of the page. |
| `ctx.shop.live_chat.welcome_message` | String | Required | The first message the chat shows, in the shopper's language: the store's own text in Storefront Messages, else Tringify's. |
| `ctx.shop.metafields` | Metafields | Optional |  |
| `ctx.shop.name` | String | Required |  |
| `ctx.shop.pickup_locations` | Array of pickup location | Optional |  |
| `ctx.shop.predictive_search_enabled` | Boolean | Optional | Whether predictive search answers: true only while storefront search and predictive search are both on. When false, routes.search_suggest_url answers 404: let the search box submit to routes.search_url without fetching suggestions. Always fetch suggestions from routes.search_suggest_url, which carries the page's language and country address, never a fixed /search/suggest path. |
| `ctx.shop.primary_domain` | String | Optional |  |
| `ctx.shop.search_enabled` | Boolean | Optional | Whether storefront search is on (Online Store › Search in Store Admin). When false, routes.search_url and routes.search_suggest_url answer 404: hide the search box and search links. |
| `ctx.shop.timezone` | String | Optional | The store's time zone as an IANA name (Settings → General), such as "Asia/Kolkata" or "Europe/Berlin". Use it for store-time logic in the browser, such as a dispatch cut-off countdown: new Intl.DateTimeFormat(lang, {timeZone: shop.timezone}) gives the store's current date and time, daylight saving included. Pages are cached, so read the clock in the browser rather than printing a time from the page. |
| `ctx.shop.utc_offset` | String | Optional | The store time zone's UTC offset when the page was made, as +HH:MM or -HH:MM (such as "+05:30"). A fallback for browsers without Intl time-zone support; it can be stale across a daylight-saving change, so prefer shop.timezone. |

## ctx.menus

Available navigation menus keyed by handle (summaries, no items). A menu setting resolves the chosen menu to its full item tree; a setting that names a handle the menu was renamed from still finds it (up to 20 old handles), while this map lists each menu under its current handle only. Available on every storefront route. Declare it in `ctx_needs` before reading it.

| Field | Type | Requirement | Description |
| --- | --- | --- | --- |
| `ctx.menus` | Object keyed by name | Declared root |  |
| `ctx.menus.{key}` | Menu summary | Dynamic key |  |

## ctx.routes

Canonical storefront URLs using the store's locale, country, and permalink configuration. Available on every storefront route. Declare it in `ctx_needs` before reading it.

| Field | Type | Requirement | Description |
| --- | --- | --- | --- |
| `ctx.routes` | Object | Declared root |  |
| `ctx.routes.account_addresses_url` | URL | Required | The account page's address book (/account/addresses). |
| `ctx.routes.account_cases_url` | URL | Optional | The account page's help requests (cases) the shopper opened or the store opened for them (/account/cases); one case is /account/cases/<number>. |
| `ctx.routes.account_details_url` | URL | Required | The account page's personal details (/account/details). |
| `ctx.routes.account_gift_cards_url` | URL | Required | The account page's gift cards, received and sent (/account/gift-cards). |
| `ctx.routes.account_orders_url` | URL | Required | The account page's orders section (/account/orders). |
| `ctx.routes.account_store_credit_url` | URL | Required | The account page's Store Credit balance and history (/account/store-credit). |
| `ctx.routes.account_url` | URL | Required | The account page. It opens the orders section (customer.account_section is orders). |
| `ctx.routes.blog_url` | URL | Required |  |
| `ctx.routes.brands_url` | URL | Required |  |
| `ctx.routes.canonical_url` | String | Optional | This page's full canonical address, the same value as its <link rel="canonical">: the domain it is served on, the page's language and country address and the entity's slug in that language, with the page number on a paged listing and no filter, sort, search inside a listing or tracking parameter (a narrowed listing gives its plain first page). Use it to share or quote the page (a WhatsApp or email link, a share button). In the theme editor and Store Admin previews it is the page's address on the domain the preview is served from. "" when the page has none: the not-found page, the password, coming-soon and maintenance pages, a preview of an unpublished blog post, and sample content in a preview. |
| `ctx.routes.cart_url` | URL | Required |  |
| `ctx.routes.categories_url` | URL | Required |  |
| `ctx.routes.checkout_url` | URL | Required |  |
| `ctx.routes.collections_url` | URL | Required |  |
| `ctx.routes.login_url` | URL | Required |  |
| `ctx.routes.register_url` | URL | Required |  |
| `ctx.routes.root_url` | URL | Required |  |
| `ctx.routes.search_suggest_url` | URL | Required | Predictive search (append ?q=) in the page's language and country address, so suggestions are titled, priced and linked for that address. JSON: {query, groups: [{type, has_more, items}], search_url}. It answers 404 while shop.predictive_search_enabled is false. |
| `ctx.routes.search_url` | URL | Required | The search results page in the page's language and country address (append ?q=). It answers 404 while shop.search_enabled is false. |
| `ctx.routes.shop_url` | URL | Required |  |
| `ctx.routes.vendors_url` | URL | Required |  |
| `ctx.routes.wishlist_url` | URL | Required |  |

## ctx.localization

Current locale and the country and language choices enabled for this storefront. Available on every storefront route. Declare it in `ctx_needs` before reading it.

| Field | Type | Requirement | Description |
| --- | --- | --- | --- |
| `ctx.localization` | Object | Declared root |  |
| `ctx.localization.available_countries` | Array of country | Required |  |
| `ctx.localization.available_languages` | Array of language | Required |  |
| `ctx.localization.baseline_locale` | String | Required |  |
| `ctx.localization.country` | Country or null | Required; may be null |  |
| `ctx.localization.locale` | String | Required |  |
| `ctx.localization.money_format` | Object | Required | How `\| money` writes amounts on this page, as data. Format client-side money (running totals, slider bounds) with exactly this algorithm so it matches server-rendered prices. Start from an exact decimal in this currency (sum in minor units, never floats) rounded half away from zero to places. Take pattern, or alpha when the symbol's edge next to the number (its last character if ¤ comes before the number, else its first) is a letter. Split it on ";": use the second part for a negative non-zero amount, else "-" + the first; use the first part otherwise. Group the whole part from the right: the first group is 3 digits, later groups are 2 when the pattern contains "#,##,##" else 3, and only when the whole part has at least 3 + minimum_grouping digits; join the groups with group. Append decimal and the fraction when places > 0 (or drop both for trim_zeros on a whole amount). Map every ASCII digit through digits. In the pattern, replace each - with minus, then the #/0 run with the number, then ¤ with symbol (wrapped in U+2066…U+2069 when the pattern contains U+200F or U+061C and the symbol has Latin letters). |
| `ctx.localization.money_format.alpha` | String | Required | The pattern to use instead when the symbol's edge next to the number is a letter (US$, CHF); empty when the locale has none. |
| `ctx.localization.money_format.currency_code` | String | Required | The page currency (ISO 4217), the one every money value on the page is in. |
| `ctx.localization.money_format.decimal` | String | Required | Decimal separator. |
| `ctx.localization.money_format.digits` | Array of string | Required | The ten digits 0-9 in this locale's numbering system; replace each ASCII digit with digits[d]. |
| `ctx.localization.money_format.group` | String | Required | Grouping separator. |
| `ctx.localization.money_format.minimum_grouping` | Integer | Required | Group only when the whole part has at least 3 + minimum_grouping digits (2 in Spanish: 1234 € but 12.345 €). |
| `ctx.localization.money_format.minus` | String | Required | Minus sign; replaces every - in the pattern. |
| `ctx.localization.money_format.pattern` | String | Required | The CLDR currency pattern, such as "¤#,##,##0.00" or "#,##0.00 ¤": ¤ is the symbol, the #/0 run is the number, an optional ";" separates a negative pattern. |
| `ctx.localization.money_format.places` | Integer | Required | Decimal places `\| money` shows for this currency (0 for JPY or IDR, 2 for INR, 3 for KWD). `trim_zeros: true` shows none when the amount is whole after rounding to these places. |
| `ctx.localization.money_format.symbol` | String | Required | The currency symbol in this locale, such as ₹, € or US$. |

## ctx.localization_prompt

The platform decision for whether to offer a country or language change to this visitor. Available on every storefront route. Declare it in `ctx_needs` before reading it.

| Field | Type | Requirement | Description |
| --- | --- | --- | --- |
| `ctx.localization_prompt` | Object | Declared root |  |
| `ctx.localization_prompt.can_choose_country` | Boolean | Required |  |
| `ctx.localization_prompt.can_choose_locale` | Boolean | Required |  |
| `ctx.localization_prompt.current_country_code` | String | Required |  |
| `ctx.localization_prompt.dismissal_days` | Integer | Required |  |
| `ctx.localization_prompt.dismissed` | Boolean | Required |  |
| `ctx.localization_prompt.enabled` | Boolean | Required |  |
| `ctx.localization_prompt.mode` | String | Required |  |
| `ctx.localization_prompt.reason` | String | Required |  |
| `ctx.localization_prompt.should_show` | Boolean | Required |  |
| `ctx.localization_prompt.suggested_country_code` | String | Required |  |
| `ctx.localization_prompt.visitor_country_code` | String | Required |  |

## ctx.breadcrumbs

The platform-resolved entity trail (items, last one current) and home, the store root named as the store is named, so a theme renders home then items in every language. Available on the routes that provide this data when declared in `ctx_needs`.

| Field | Type | Requirement | Description |
| --- | --- | --- | --- |
| `ctx.breadcrumbs` | Object | Declared root |  |
| `ctx.breadcrumbs.home` | Pagination link or null | Required; may be null |  |
| `ctx.breadcrumbs.items` | Array of pagination link | Required |  |

## ctx.consent

Visitor consent state. available_categories lists the optional cookie categories the consent banner offers, in display order; categories lists the ones the visitor has granted. Available on every storefront route. Declare it in `ctx_needs` before reading it.

| Field | Type | Requirement | Description |
| --- | --- | --- | --- |
| `ctx.consent` | Object | Declared root |  |
| `ctx.consent.available_categories` | Array of string (`analytics`, `advertising`, `advertising_data`, `personalized_advertising`, `personalization`) | Required |  |
| `ctx.consent.categories` | Array of string | Required |  |
| `ctx.consent.given` | Boolean | Required |  |
| `ctx.consent.required` | Boolean | Required |  |

## ctx.age_gate

The store's age gate for this visitor: show is true when the gate applies to the visitor's country. Copy is already in the shopper's language, with the minimum age filled in. Render the gate as the global_overlay section age-gate, and render it only when ctx.age_gate.show is true: the platform adds its gate runtime only then, so a gate rendered while show is false can never be dismissed. Give its root data-tf-age-gate, role="dialog", aria-modal="true" and an aria-labelledby heading, and mark the buttons data-tf-age-gate-confirm and data-tf-age-gate-decline. The platform hides it before first paint for visitors who already confirmed, traps focus, stores the answer for remember_days days (0: the browser session) and handles declining (decline_url, or its own come-back-later screen when decline_url is empty). Keep the page content in the HTML. If the theme renders no age-gate section, the platform adds a plain one. Available on every storefront route. Declare it in `ctx_needs` before reading it.

| Field | Type | Requirement | Description |
| --- | --- | --- | --- |
| `ctx.age_gate` | Object | Declared root |  |
| `ctx.age_gate.body` | String | Required |  |
| `ctx.age_gate.confirm_label` | String | Required |  |
| `ctx.age_gate.decline_label` | String | Required |  |
| `ctx.age_gate.decline_url` | String | Required |  |
| `ctx.age_gate.enabled` | Boolean | Required |  |
| `ctx.age_gate.heading` | String | Required |  |
| `ctx.age_gate.min_age` | Integer | Required |  |
| `ctx.age_gate.remember_days` | Integer | Required |  |
| `ctx.age_gate.show` | Boolean | Required |  |

## ctx.csrf_token

The signed form nonce for hosted storefront mutations. Available on every storefront route. Declare it in `ctx_needs` before reading it.

| Field | Type | Requirement | Description |
| --- | --- | --- | --- |
| `ctx.csrf_token` | String | Declared root |  |

## ctx.design_mode

True while the theme editor renders the page for the merchant, false for shoppers. Use it to show placeholders for content the merchant has not chosen yet, and render nothing for shoppers instead. Available on every storefront route. Declare it in `ctx_needs` before reading it.

| Field | Type | Requirement | Description |
| --- | --- | --- | --- |
| `ctx.design_mode` | Boolean | Declared root |  |

## ctx.theme_preview

True when the page renders sample content in a theme preview (the theme store demo and the theme tooling preview), false on a store. Use it for a theme's own sample artwork where a merchant setting is empty; a store shows nothing there instead. Available on every storefront route. Declare it in `ctx_needs` before reading it.

| Field | Type | Requirement | Description |
| --- | --- | --- | --- |
| `ctx.theme_preview` | Boolean | Declared root |  |

## ctx.storefront

The storefront's own state, for its password, coming-soon and maintenance pages: the launch date a coming-soon page counts down to, the time a maintenance page expects to be back, and the link that lets the store owner sign in and see the store past the page. Times are RFC 3339 in the store's time zone with its offset (shop.timezone); pages are cached, so compare them with the browser's clock rather than printing a countdown from the page. Available on every storefront route. Declare it in `ctx_needs` before reading it.

| Field | Type | Requirement | Description |
| --- | --- | --- | --- |
| `ctx.storefront` | Object | Declared root |  |
| `ctx.storefront.launch_at` | Timestamp or null | Optional; may be null | When the store opens, as the merchant set it for Coming Soon (Store Admin › Online Store › Status); null when no launch date is set. Count down to it on the coming-soon page. Once it has passed the store may still be in Coming Soon (it opens on its own only when the merchant chose that): show "Opening soon" or the page's own text instead of a countdown below zero. |
| `ctx.storefront.maintenance_until` | Timestamp or null | Optional; may be null | When the merchant expects the store back from maintenance (Store Admin › Online Store › Status); null when not set. Show it as "Back around …" in the shopper's language and shop.timezone. It is an estimate: the store never reopens on its own, so once it has passed show the page's own text instead. |
| `ctx.storefront.owner_login_url` | URL or null | Optional; may be null | The store owner's way past this page: Store Admin's sign-in, which after signing in opens this same page as staff (a preview only they see). Set on the password, coming-soon and maintenance pages, null on every other page. It carries no token: link to it as given, for example "Are you the store owner? Sign in". |

