Docs

Prepare variant templates in Shopify

A template test compares Shopify theme templates, so each variant needs its own template. Here's how to make one.

In a template test, the control is the template your pages use today, and each variant is a different template you build in Shopify. ab.one then shows each template to its share of visitors.

Create a template in the theme editor

  1. Open your live theme

    In your Shopify admin, go to Online Store → Themes and click Customize on your live theme.

  2. Pick the kind of page

    Open the page menu at the top of the editor and choose the kind of page you want to test, for example Products or Collections.

  3. Create the template

    Click Create template. Enter a name and, under Based on, choose the template your pages use today. Click Create template.

  4. Make your change and save

    Change what you want to test, then click Save.

Creating a template changes nothing for visitors. Your pages keep their template until a test runs or you switch them yourself.

Alternative: in the code editor

If you prefer code: Online Store → Themes → ⋯ → Edit code → Templates → Add a new template. Pick the type (for example product), choose JSON, enter a name and click Done.

Naming tips

  • Name the template after the change: reviews-up, hero-video, free-shipping-badge. You'll see this name in ab.one and in the page address of variant visitors (?view=reviews-up).
  • Use lowercase letters, numbers and dashes.
  • Don't reuse a template from an old test for something new. Make a fresh one, so old results stay meaningful.

Rules ab.one checks

When you pick templates in the wizard, ab.one makes sure the test can work. If something doesn't fit, it shows a message and won't continue:

RuleMessage you might see
A test has the control and at least one variant.A template test needs a control and at least one variant.
Every version is the same kind of page, for example all product templates.Control and variants must use templates for the same Shopify resource type.
All versions belong to the same market context.Control and variants must use templates from the same Shopify market context.
Each variant uses its own, different template. A variant can't reuse the control's template or another variant's.Each variant needs its own alternate template with a distinct storefront view.
A test has exactly one control.A test needs exactly one control variant.

Templates and themes

Templates belong to a theme. A template you create in your live theme only exists there, so publishing a different theme pauses template tests until the original theme is live again. If you're working on a new theme, finish your tests first, or create the templates again in the new theme. Changing themes while testing explains more.