Template tests

Compare two versions of the same page by serving an alternate theme template you have already built, chosen by its suffix.

What a template test is

A template test keeps visitors on the same URL but serves two different theme templates for it: your live template (the control) and an alternate template version (the challenger). This is the right test type when you want to change the layout or content of a page — a product page, collection, or landing page — using Shopify's own theme system rather than a redirect to a separate URL.

Shopify lets a single resource have more than one template. Alternate templates share a base name and add a suffix, for example product.hero-b. The suffix (hero-b) is what AB Test uses to serve the challenger to the visitors assigned to that variant.

Template tests are available on every plan. The Base plan includes any 2 test types; Premium includes all 4.

AB Test never creates or edits theme files

This is the most important thing to know before you begin: AB Test does not create, duplicate, or modify any file in your theme. It only serves a template that already exists by appending a suffix to the request. You are responsible for building the alternate template yourself in Shopify's theme editor, exactly as you would for any other design change.

Because the app touches no theme files, there is nothing for it to clean up when a test ends, and your published theme is never altered by running a test.

If you would rather not build a template and want to change your whole theme instead, use a theme test. If you just want to send traffic to a different URL, use a URL redirect test.

Create the alternate template first

Build your challenger in Shopify before you set up the test. You only do this once per challenger.

  1. In your Shopify admin, go to Online Store > Themes.
  2. Open Customize on the theme you want to test.
  3. Use the template picker at the top of the editor to create a new template for the resource type you are testing (for example, product). Give it a suffix name such as hero-b. Shopify saves it as product.hero-b.
  4. Edit the new template — rearrange sections, swap blocks, change copy — then save. Leave your original template untouched; it stays the control.

You do not need to assign the alternate template to any product or page. AB Test applies it at request time using the suffix, so the control resource keeps its normal template for everyone who is not in the challenger variant.

Test both templates on the theme that is actually published. If you build the challenger on an unpublished theme, live visitors will not receive it.

Set up a template test

Once the alternate template exists, create the test in the AB Test admin.

  1. In the AB Test app, create a new experiment and choose Template as the test type.
  2. Choose the template type you are testing (for example, product or collection) and the specific page the test runs on.
  3. Enter the challenger suffix — the suffix of the alternate template you built, such as hero-b. Your live template stays as the control.
  4. Set your audience targeting and traffic split, then optionally schedule an end date. Experiments auto-end at their scheduled end date.
  5. Launch. The storefront embed begins assigning visitors and serving the right template.

How serving works

When a visitor lands on the tested page, the storefront app embed assigns them to a variant and keeps that assignment stable for the rest of their visit. Visitors in the control see the page's normal template. Visitors in the challenger are served the alternate template by adding Shopify's view parameter to the request:

https://your-store.com/products/example?view=hero-b

Shopify recognizes ?view=hero-b and renders product.hero-b instead of the default product template. The URL path stays the same, so links, canonical structure, and navigation are unaffected. Because both variants live on your store's own domain, revenue is attributed through the standard flow, including third-party checkout.

VariantTemplate servedRequest
Controlproduct/products/example
Challengerproduct.hero-b/products/example?view=hero-b

Template test vs theme test

Both test types compare theme-level experiences, but at different scope. Pick the one that matches what you changed.

Template testTheme test
What variesOne template within your live themeAn entire alternate theme
How it is served?view=<suffix>?preview_theme_id=<id>
You prepareAn alternate template you build in the theme editorA duplicate or alternate theme
Best forChanging one page type — layout, sections, copyTesting broad or cross-site design changes

Use a template test when the change is scoped to a single page type and you can express it as an alternate template. Use a theme test when the change spans many pages or is easier to manage as a separate theme.

Read results and apply the winner

As visitors browse and buy, AB Test records views, conversions, and revenue for each variant and computes Bayesian results — probability to be best, per-variant conversion rate and revenue, and segment breakdowns. When a variant wins, you can apply it in one click.

Because AB Test does not manage theme files, applying the winning challenger means making its template your live one. You do that in the theme editor: set the alternate template as the template for the resource, or copy its changes into your default template. AB Test tells you which variant won; publishing the change stays in your control.

Keep the app embed and Web Pixel enabled while a template test runs — the embed is what assigns visitors and serves the alternate template.

Related pages