Shopify Builds>Primitives>Liquid snippets

Liquid snippets

Definition

A snippet is a Liquid file rendered inside another file with the render tag, which gives it an isolated scope and named arguments. It carries no schema and no settings of its own. Snippets are how a theme keeps one implementation of a recurring thing, a product card, an image, a price, across every section that needs it.

Documented at shopify.dev, theme architecture.

How We've Used It

A snippet is where we put the thing that has to look identical everywhere and change in one place. The card rendering in a grid, a search result, a navigation rail and a recommendation carousel is one file with its options passed as arguments; so is the image pipeline behind it, and the structured data emitted per page type. Two habits keep that from turning into a mess: arguments documented at the top of the file, and per-instance overrides expressed as custom properties scoped to a generated id rather than as new classes. The failure mode is a snippet nothing renders any more, which is why working out who calls what is part of the job.

Builds Using It

Related Entities

Builds

Accessible link-label helpers for repeated CTAs

Two Liquid snippets that resolve a real conflict between two link-naming rules — identical link text on different destinations versus an accessible name that must contain the visible label — by deriving a name from the link's href and emitting it only when it differs from what the shopper can see.

Nudestix

Hand-authored per-market JSON-LD for the Bundles & Kits collection

One Liquid snippet in the layout's head carries a complete schema.org graph for the Bundles & Kits collection — breadcrumb, collection page, a product list with offers, and the page's FAQ — written twice, once for the Canadian storefront and once for the US one.

Three Ships

Tabbed collection product slider and the shared merchandising card

One section renders every configured collection at once and switches between them with a class, so moving from Serums to Cleansers waits on nothing — and one card snippet backs the shelf, the blog and the rewards page.

Three Ships

Hero slide content renderer with per-breakpoint typography controls

One Liquid snippet renders a hero slide's pretitle, title, description and CTA from block settings, carrying the desktop and the mobile type spec on the same element as paired CSS custom properties, so two different slideshow sections share a single copy renderer.

Nudestix

Mega-menu product rail (v2): a library-free slider in a theme asset, constructed per panel when the panel is seen

The second generation of Nudestix's menu rail — a merchandiser title, a shop-all link and a track of navigation cards — keeps its slider in `megamenu-slider.js`, a small class that measures slide width at move time and is constructed per panel on first intersection.

Nudestix

Metafield-driven breadcrumbs across product, collection, page, blog and article

One breadcrumb snippet whose ancestor trail is authored per product and per collection through a `custom.breadcrumbs` collection-list metafield, with a three-level fallback for products and natural trails for pages, blogs and articles — rendered as a real navigation landmark from a single argument-free `{% render %}`.

LUS Brands

Price snippet with a bundle 'value' metafield line and opt-out labelled price links

Dawn's price snippet on Nudestix, extended in two small ways: a product metafield adds a "worth" line beside a kit's price, and the price text becomes a labelled link to the product unless the caller says otherwise.

Nudestix

Alt-text convention that maps product media to variants without metafields

Two Liquid snippets turn the alt text merchandisers already type in the Shopify media library into a variant match key and a four-tier match verdict, so a product gallery can filter media per variant at render time.

LUS Brands

Accessible play/pause web component for autoplaying hero video

A `<play-pause>` custom element that gives a muted, autoplaying hero video a real keyboard-reachable control — self-wiring from a selector in its own markup, so Swiper can clone and reorder slides without any script knowing how many there are.

Nudestix