CTX is the data layer your Liquid templates render against. Every storefront request builds a CTX object that exposes the store, the visitor, and everything resolved for them — the market, currency, and language they are being served.
What CTX exposes#
- Store — store name, base currency, and settings
- Storefront — storefront display settings
- Market, Currency, Localization — what the visitor is being served, each carrying how it was resolved
- Permalinks — URL structure for the storefront
- Session and Visitor — session state, IP, device, and user agent
- Customer — the logged-in customer, loaded on demand
- Menus, consent, and blog content — loaded lazily when a template asks for them
Resolution provenance#
Market, Currency, and Localization each record how they were chosen — an explicit visitor choice, the URL, GeoIP, or a fallback default. Templates can read this provenance to decide what to show, such as prompting a visitor to confirm a geo-detected market.
Customer actions#
CTX also exposes actions templates can call: register, log in and out, verify email and phone, reset passwords, send OTPs, update the profile, and manage saved addresses. Each action returns a structured result you check for success or an error to display.