Key Takeaways
Global objects are just there — every Liquid file, zero setup, no imports needed. Cart state, customer info, product details, store settings — it’s all sitting there waiting. Once you know what’s available and where it lives, you stop wasting an hour in the docs every single time.
The real magic is in combining objects. Customer plus cart unlocks personalization. Product plus metafields lets you store custom data that the default schema never even thought about. Knowing which combos work is honestly the difference between a basic theme and one that actually impresses people.
Liquid is a templating language, full stop. Heavy lifting, complex filtering, anything that needs actual computation — that’s JavaScript’s job. Use global objects for what they were built for, and your themes don’t become nightmares to maintain.
What Are Shopify Global Objects?
Global objects are predefined Liquid variables that Shopify automatically makes available across every template file. They hold structured data about the current store — products, collections, customers, cart contents, blog posts, navigation menus, URLs, and store settings. You don’t initialize them. Nothing to import. They’re just there the moment a Liquid file renders.
That’s literally what “global” means here.
The catch — and this one burns people, including me — is that some of these objects only carry meaningful data in specific template contexts. The product object is only populated when you’re actually on a product page. The checkout object only makes sense inside the checkout template. Use either of them somewhere else, and you don’t get an error. You get empty output. Which looks exactly like a typo in your property name. Which takes forever to track down because there’s nothing helpful to go on.
Knowing what’s available where matters just as much as knowing the properties themselves. I can’t stress that enough.
Key Categories of Global Objects
1. Store Information
These carry store-level metadata — stuff that stays consistent no matter what page a customer lands on or what they’re looking at.
The shop is the one you’ll reach for all the time. Store name, domain, email, currency, description, phone number, localization settings — all of it lives here. Any time you need to reference the store itself rather than a specific product or customer, the shop is your starting point.
<p>Welcome to {{ shop.name }}!</p>
<p>Your currency is set to {{ shop.currency }}</p>
Settings pull directly from the theme customization panel — Online Store > Customize in Shopify admin. This is how merchant-configurable values get into templates without hardcoding anything. Colors, fonts, contact emails, feature toggles. Expose them as settings, and merchants can update things themselves without ever touching code. Build themes this way, and you stop getting support tickets every time someone wants to change their contact email.
<p>Support Email: {{ settings.contact_email }}</p>
2. Customer and User Data
These deal with authenticated customer sessions. They’re essentially useless when nobody’s logged in.
The customer is the main object here. First name, last name, email, order history, saved addresses, tags — all in there. The very first thing you almost always do with this object is check whether it actually exists before you try to read any properties off it. Guest sessions return nothing, and accessing properties on a nil customer doesn’t throw an error. It just gives you blank output. Which is confusing. Which wastes time.
{% if customer %}
<p>Welcome back, {{ customer.first_name }}!</p>
{% else %}
<p>Please log in to view your account details.</p>
{% endif %}
customer.orders gives you the full order history for whoever’s logged in. This one’s only accessible inside customer account templates, by the way. Trying to use it in a homepage section won’t work the way you’d expect. If you’re building a custom account dashboard — and a lot of clients want one — this is what your order list runs through.
3. Product and Collection Data
Probably the objects you spend the most time with in everyday Shopify work.
The product represents a single product and is only available on product template pages. Everything about that product is here — title, description, price, vendor, images, variants, metafields, tags. The variants array is especially important because that’s where sizes, colors, and other options live as separate objects, each carrying its own price, SKU, inventory count, and availability.
<h1>{{ product.title }}</h1>
<p>Price: {{ product.price | money }}</p>
collection is for, well, collections of products. Available on collection template pages. Gives you the collection title, description, image, and the array of products. Looping through the collection. products is the standard pattern for any collection page layout.
<h1>{{ collection.title }}</h1>
<ul>
{% for product in collection.products %}
<li>{{ product.title }} - {{ product.price | money }}</li>
{% endfor %}
</ul>
Quick note worth knowing: collection. Products default to 50 products max per page. For larger collections, pagination is non-negotiable. Without it, the page silently cuts off at product 50, and customers never see anything beyond that. Nobody notices until someone asks why the store only seems to have half its inventory. Then it’s a fun conversation.
4. Shopping Cart and Checkout Data
Cart state is relevant on almost every page, so this object shows up constantly.
The cart holds the complete current cart — line items array, total item count, total price, applied discount codes, and cart attributes. Because it’s globally available, you can show an accurate item count in the header on every page without any extra setup. Which is exactly what you want — a persistent indicator that stays correct as customers add and remove things.
<h2>Your Cart</h2>
{% for item in cart.items %}
<p>{{ item.product.title }} - Quantity: {{ item.quantity }}</p>
{% endfor %}
<p>Total: {{ cart.total_price | money }}</p>
Checkout gives you access to order summary data inside the checkout template. Shopify controls what you can actually customize in checkout pretty tightly, but the data that is accessible — order details, customer info, shipping address — comes through this object.
5. Blog and Article Data
More stores should use Shopify’s blogging features than actually do. For themes that need to support content marketing, these matter a lot.
blog represents a single blog within the store. A store can have multiple blogs — a news section, a recipe journal, a behind-the-scenes series — and this object gives you the title, handle, and articles array for whichever one you’re working with.
<h1>{{ blog.title }}</h1>
Routes generate correct URLs for standard store pages dynamically, based on the actual store structure rather than whatever you’ve hardcoded.
<a href="{{ routes.cart_url }}">Go to Cart</a>
<a href="{{ routes.account_login_url }}">Log In</a>
Hardcoding navigation paths instead of using routes is the kind of mistake that causes broken links whenever store URL structures change. It’s also the kind of bug that gets reported months after a theme ships and takes embarrassingly long to trace back to a hardcoded string buried somewhere in a template file.
Advanced Use Cases
1. Using Metafields with Global Objects
Metafields let you attach custom data to products, collections, customers, and other Shopify resources — data that the default schema simply doesn’t have fields for. A product might need material composition, care instructions, country of origin, and sizing details that go beyond what Shopify natively supports. Metafields are how that data gets attached to the product object and into your templates.
<p>Material: {{ product.metafields.custom.material }}</p>
<p>Care Instructions: {{ product.metafields.custom.care_instructions }}</p>
2. Personalizing the Storefront with customer and cart
Combining customer and cart is where personalization goes from theoretical to actually useful. Greeting customers by name, showing real-time cart counts, displaying messaging that changes based on login status — all of it comes from these two objects working together.
This pattern turns up everywhere in well-built themes. Header components that greet returning customers. Promotional banners that vary by account status. Checkout flows that pre-fill details for logged-in users. The combination makes all of it possible without any external data fetching.
3. Custom Sorting and Filtering
Liquid’s sort filter applied to collection products gives you custom ordering beyond the default sort options — price, alphabetical, and creation date.
{% assign sorted_products = collection.products | sort: 'price' %}
{% for product in sorted_products %}
<p>{{ product.title }} - {{ product.price | money }}</p>
{% endfor %}
The limitation is worth understanding before you build anything significant on top of this: Liquid-side sorting works only on products already loaded into the page. Usually, the 50-product default. You’re not sorting across the entire collection — you’re sorting within the current page. For real cross-collection filtering at any scale, you need JavaScript and the Storefront API, or an app.
Tips for Working with Global Objects
Keep the docs open. The Shopify Liquid reference is thorough and actively maintained. Global objects expose far more properties than anyone memorizes, and relying on memory for property names is how you spend 20 minutes debugging something that turns out to be a typo that renders silently as nothing.
Combine objects deliberately. The most useful Liquid patterns come from combining global objects rather than using each one in isolation. Think through what data you actually need and which combination exposes it. customer plus cart for personalized experiences. product plus collection for breadcrumb navigation. shop plus settings for store-specific configurations.
Use the Theme Editor for actual testing. Shopify’s preview mode renders templates with real store data. Some properties that should return something come back empty in certain contexts. The Theme Editor catches that before it hits a live store and becomes a support ticket.
Take loops seriously. Nested loops — collections inside collections, products inside collections, variants inside products — compound rendering time faster than you’d expect, and are genuinely unpleasant to profile after the fact. If a loop is getting complicated, that’s usually a signal that the logic should move to JavaScript or the value should be precomputed somewhere.
Common Pitfalls
Accessing objects outside their valid context. The product object is populated only on product pages.Know which templates each object belongs to before writing logic that depends on it.
Putting too much logic in Liquid. This one comes up constantly. Liquid is built for displaying data, not processing it. The moment you’re writing deeply nested conditionals, trying to implement search in Liquid, or chaining long string manipulation sequences — stop.
Chaining filters without testing each step. Liquid filters are easy to chain, and that ease makes it easy to chain too many without checking what happens in between. money, strip_html, url_encode, date — each one transforms the value, and the order matters.
Forgetting empty states. Empty cart. Collection with no products. Customer with no order history. Write an explicit empty state for every list and loop you build. Every single one. No exceptions.
Wrapping Up
The gap between a developer who struggles in Liquid and one who moves through Shopify theme work confidently is mostly a gap in understanding global objects — what exists, where it’s available, and how to combine things.
The practical advice that’s actually helped: build things, break things, use the Theme Editor constantly, and read the docs when behavior doesn’t match expectations instead of trying to logic your way to an answer. Global objects are consistent and well-documented. When something seems wrong, it’s almost always a context issue or a typo, and the docs will tell you which.
About Innostax
Innostax specializes in managed engineering teams and was founded in 2014. It is headquartered in Framingham, Massachusetts. We establish engineering teams with accountability as a priority for both startups and enterprises, helping them achieve consistent software velocity with no customer churn.
Read more: Deep Dive into Shopify’s Global Objects in Liquid
Top comments (0)