CTX is the data available to a hosted Vascula theme: products, prices, navigation, carts, customer information, the shopper's country and language, cookie consent, and other storefront content. Declare what each section needs in its schema, then read the objects by name in the template.
Declare the data you read#
For a product summary with the shop name and a cart count, add these declarations to the section schema. Requesting only cart.item_count keeps the section focused on the count; request cart.items when you need the cart's product lines.
{
"ctx_needs": ["shop", "product", "cart.item_count"]
}
<p>{{ shop.name }}</p>
{% if product %}
<h1>{{ product.title }}</h1>
<div>{{ product.description }}</div>
{% if product.price %}
<p>{{ product.price.current | money: isolate: true }}</p>
{% endif %}
{% endif %}
<span>Cart: {{ cart.item_count }}</span>
The money filter formats a price in the shopper's language and the price's currency. The isolate: true option marks the formatted price as a separate run of text, so it stays in the right order when it appears next to text written in the opposite direction, such as a price inside an Arabic or Hebrew sentence. Use it whenever a price sits inside other text. See Money and Language Formatting.
The reference uses names such as ctx.product to identify the contract. In Vascula expressions, write product.title, not ctx.product.title. Use the exact lowercase names shown in the reference.
Availability and missing values#
A declaration does not make unrelated route data appear. Product data belongs to product pages; listing and search data belongs to those routes. Customer data is absent for a guest. Check optional objects before reading them, and treat null as unavailable rather than replacing it with an invented price or quantity.
Password, coming-soon, and maintenance screens have a limited context containing shop.name. Build those screens without requiring catalog, cart, customer, or session-related data.
There is no standalone currency or market root. Prices carry their currency_code, and localization contains the active language, the active country, and the country and language choices. See Locale, country, and currency.
Where to go next#
Runtime context: which roots to declare for each kind of section.
Customers, carts, and consent: sign-in, cart, wishlist, and cookie-consent controls.
Locale, country, and currency: country and language switchers, country addresses, and price formatting.
Consent categories: the cookie categories and when visitors are asked.
Context Reference: every field, its type, and whether it can be missing or null.
Hosted Actions: the forms that change storefront state.