Shopify alternate templates let one resource type have more than one layout. You add a file such as templates/product.outerwear.json, then assign the outerwear suffix to the products that should use it, in the admin or through the Admin API’s templateSuffix field. The assignment is stored on the product. The file lives in the theme. When the live theme has no file for a suffix, the product renders with the default template and nothing warns you.
That split between store data and theme code is where alternate templates go wrong. A new theme goes live without product.outerwear.json, a developer deletes an unused-looking template, or someone renames a file. The products still say outerwear. They just stop looking like it.
How do you name an alternate template?
Shopify’s alternate templates guide gives the pattern template-name.template-suffix.template-file-type, where the file type is json or liquid. So a second product template called outerwear is product.outerwear.json. The suffix is the bit in the middle, and it is the only part the admin and the API ever see.
The JSON templates reference adds the limits:
A template exists as JSON or as Liquid, never both, so product.outerwear.json and product.outerwear.liquid cannot sit in the same theme.
A JSON template renders up to 25 sections, and each section takes up to 50 blocks.
A theme holds at most 1,000 JSON templates across all types, and once it reaches that you cannot create another. A store that makes a new template for every campaign can get there.
You cannot replace the default. product.json stays the fallback whatever you assign.
A minimal alternate template looks like any other JSON template. This one reuses the theme’s main product section and swaps the recommendations for a size guide section:
{
"sections": {
"main": {
"type": "main-product",
"settings": {}
},
"size-guide": {
"type": "size-guide"
}
},
"order": ["main", "size-guide"]
}
Both section types have to exist in the theme’s sections/ folder. main-product is Dawn’s name for it; check your own theme’s.
What does ?view= do on a Shopify URL?
Any alternate template can be rendered on demand with the view parameter: /products/example-product?view=outerwear renders that product with product.outerwear.json, whether or not the product is assigned to it. That makes it the quickest way to preview a template against real products before you assign anything.
It also means the template is public. Anyone can add ?view=outerwear to any product URL. So an alternate template is a layout, never an access control. If a “trade” template shows prices or stock levels you would not put on the normal page, a customer who guesses the suffix sees them too.
Inside the template, the Liquid template object tells you which one is running. template.name is the type (product, collection, page and so on) and template.suffix is the alternate’s name, or nil on the default. A body class built from them is handy for CSS that should only apply to one layout:
<body class="template-{{ template.name }}{% if template.suffix %} template-{{ template.name }}--{{ template.suffix | handle }}{% endif %}">
We would stop there and not branch on template.suffix inside a shared section. A section with three if template.suffix == ... branches hides its logic from the theme editor, so the merchant can no longer see why a page looks the way it does. Give each layout its own section instead.
Where is a Shopify template assignment stored?
On the resource. templateSuffix is a plain String field on Product, Collection and Page in the Admin GraphQL API, so the value belongs to the store and survives every theme change.
The theme side behaves differently. The help centre’s templates page says template changes apply only to the theme they were made in, and the admin’s Theme template drop-down only lists templates that exist in the current live theme. It also says that when a template is deleted, the resources using it “display with the default template until you assign a different one”.
Put those together and the failure is easy to predict. You build a new theme, publish it, and every product assigned to a suffix that the new theme lacks quietly renders as a default product page. The API still returns outerwear for those products, because the value lives on the product.
How do you assign templates in bulk?
For products and collections, the admin Bulk editor has a Template column. Add it, select a range and set the value. The help centre notes that the Bulk editor no longer supports pages or blog posts, so those go one at a time or through the API.
For anything repeatable, use the API. The script below takes a products search string, a suffix and the path to a local theme checkout. It refuses to run if the theme does not have the template, then pages through the matching products and calls productUpdate only where the value would change. Our queries were written against Admin API 2026-10, which is the latest stable version as of November 2026, and validated against that schema.
Both scripts share a small fetch wrapper. It needs a custom app token with read_products and write_products:
// admin.mjs
const API = `https://${process.env.SHOP}/admin/api/2026-10/graphql.json`;
export async function admin(query, variables) {
const res = await fetch(API, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Shopify-Access-Token': process.env.SHOPIFY_ADMIN_TOKEN,
},
body: JSON.stringify({ query, variables }),
});
if (!res.ok) throw new Error(`Admin API returned HTTP ${res.status}`);
const body = await res.json();
if (body.errors) throw new Error(JSON.stringify(body.errors));
return body.data;
}
// node assign-template.mjs "tag:outerwear" outerwear path/to/theme/templates
import { access } from 'node:fs/promises';
import { admin } from './admin.mjs';
const [search, suffix, dir = 'templates'] = process.argv.slice(2);
// Refuse to assign a template the theme does not have.
await access(`${dir}/product.${suffix}.json`).catch(() =>
access(`${dir}/product.${suffix}.liquid`),
);
const PRODUCTS = `#graphql
query MatchingProducts($search: String!, $cursor: String) {
products(first: 250, after: $cursor, query: $search) {
nodes { id handle templateSuffix }
pageInfo { hasNextPage endCursor }
}
}`;
const UPDATE = `#graphql
mutation AssignTemplate($product: ProductUpdateInput!) {
productUpdate(product: $product) {
product { handle templateSuffix }
userErrors { field message }
}
}`;
let cursor = null;
do {
const { products } = await admin(PRODUCTS, { search, cursor });
for (const { id, handle, templateSuffix } of products.nodes) {
if (templateSuffix === suffix) continue;
const { productUpdate } = await admin(UPDATE, {
product: { id, templateSuffix: suffix },
});
if (productUpdate.userErrors.length > 0) {
console.error(handle, productUpdate.userErrors);
process.exitCode = 1;
} else {
console.log(`${handle}: ${templateSuffix ?? '(default)'} -> ${suffix}`);
}
}
cursor = products.pageInfo.hasNextPage ? products.pageInfo.endCursor : null;
} while (cursor);
Run it with the products search syntax you would use anywhere else, for example node assign-template.mjs "tag:outerwear AND status:active" outerwear ./theme/templates. Each update is one mutation, which is fine for hundreds of products. For tens of thousands, move the writes into a bulk operation so you are not spending the rate limit one call at a time.
Collections and pages take the same field. In 2026-10, collectionUpdate takes a collection argument of type CollectionUpdateInput (the older input argument is deprecated), and pageUpdate takes id plus a page: PageUpdateInput. The PageUpdateInput reference is the one place the docs state that an empty or null templateSuffix means the default page template.
How do you find products using a missing template?
You cannot search for them. The products query’s search filters cover tags, vendor, status, metafields and plenty more, but nothing for the template, so the only way to find every product on a given suffix is to read every product.
That costs one request per 250 products. This audit reads the product suffixes from a theme checkout and then pages through the whole catalogue. It prints every product whose templateSuffix has no matching file:
// node audit-templates.mjs path/to/theme/templates
import { readdir } from 'node:fs/promises';
import { admin } from './admin.mjs';
// product.outerwear.json -> "outerwear"
const files = await readdir(process.argv[2] ?? 'templates');
const suffixes = new Set(
files
.map((file) => file.match(/^product\.(.+)\.(json|liquid)$/)?.[1])
.filter(Boolean),
);
const PRODUCTS = `#graphql
query ProductTemplates($cursor: String) {
products(first: 250, after: $cursor) {
nodes { handle templateSuffix }
pageInfo { hasNextPage endCursor }
}
}`;
const missing = [];
let cursor = null;
do {
const { products } = await admin(PRODUCTS, { cursor });
for (const product of products.nodes) {
if (product.templateSuffix && !suffixes.has(product.templateSuffix)) {
missing.push(product);
}
}
cursor = products.pageInfo.hasNextPage ? products.pageInfo.endCursor : null;
} while (cursor);
console.table(missing);
process.exitCode = missing.length > 0 ? 1 : 0;
It exits non-zero when anything is missing, so it can gate a theme release. Run it against the branch you are about to publish rather than the live theme, because the live theme is the one that already works. If you deploy themes from CI the way we describe in our GitHub Actions theme deploy post, it belongs in the same workflow, before the theme is published. The same pattern extends to collections and pages by changing the query and the product. prefix in the regex.
When should you use Shopify alternate templates?
Use one when a group of products, collections or pages needs a genuinely different set of sections, and the merchant should be able to move a product in or out of that group without asking a developer. Outerwear with a size guide, made-to-order items with a lead-time section, landing pages with no header promotions: those are good fits.
Skip it when the difference is a single value. A different badge, a different line of copy or a hidden price belongs in a metafield read by the default template, where it stays visible on the product and cannot be lost in a theme change. And skip it for anything you need to keep private, because ?view= will show it to whoever asks.
Whichever you choose, run the audit before every theme launch.
We build and maintain Shopify themes, including the migrations where a store’s old template assignments have to survive a new theme. If yours has drifted, our Shopify development work can start with this audit.