# Troubleshooting Template Tests

Running into issues with a template test? This guide covers the most common problems and how to fix them.

### I accidentally edited my original template

If you make changes to your A (original) template instead of your B (variant), those changes go live immediately for all visitors, including those not in your test.

#### How this happens

The Shopify Theme Editor looks the same whether you're editing your original or your variant. It can be easy to accidentally switch to the wrong template without realizing it.

#### How to prevent it

Before making any edits, check the template name at the top of the Theme Editor. Your variant template will have a different name from your original. Confirm you're editing the variant before making changes.

<figure><img src="https://314821113-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDg2m2UmvTCMjmBjnzBKA%2Fuploads%2FwnMdroXVmrN3MrWWTAnQ%2Ftemplate%20picker%20theme%20editor.png?alt=media&#x26;token=1685e471-3413-4142-a9f0-034fe3c5dff3" alt=""><figcaption></figcaption></figure>

#### How to fix it

If you've already made changes to your original:

1. **Undo immediately** if you're still in the Theme Editor. Use **Ctrl+Z** (Windows) or **Cmd+Z** (Mac) to revert your changes, then click **Save**.
2. **If you've already saved and closed**, you'll need to manually revert the changes. Open your original template in the Theme Editor and undo whatever you changed.
3. **If you're not sure what changed**, check your theme's version history in Shopify. Go to **Online Store** > **Themes** > **...** (more actions) > **View version history** to see recent edits.

{% hint style="warning" %}
Edits to your original template affect your live store right away, whether or not a test is running. Always double-check which template you're editing.
{% endhint %}

### My variant looks broken or unstyled

If your variant page is missing styles, has a broken layout, or looks different from what you expected, your theme likely has code that checks the template name using an exact match. This is the most common technical issue with template tests.

#### Why this happens

When Shoplift creates a variant, it duplicates your template with a slightly different filename. For example, `product.liquid` becomes `product.sl-XXXXXXXX.liquid`.

Some themes include code that checks the template name to load styles, scripts, or sections. Code like this:

liquid

```liquid
{% if template == 'product' %}
  {{ 'product-styles.css' | asset_url | stylesheet_tag }}
{% endif %}
```

This code loads styles only when the template name is exactly `product`. Your variant's template name is `product.sl-XXXXXXXX`, so the check fails and the styles don't load. The page appears broken or unstyled as a result.

#### What to look for

Common symptoms include:

* Missing CSS (the page looks unstyled or uses default browser styling)
* JavaScript features not working (sliders, tabs, accordions, product image galleries)
* Sections that appear on your original but are missing from your variant
* Navigation highlighting not working on variant pages
* The wrong page layout being applied

#### How to fix it

This requires a small update to your theme code. If you're comfortable editing Liquid, you can make the change yourself. Otherwise, share this section with your developer.

The fix is to replace exact template name checks with `contains`, which checks whether a string appears anywhere in the template name instead of requiring an exact match:

liquid

```liquid
{% comment %} ❌ This breaks in template tests {% endcomment %}
{% if template == 'product' %}

{% comment %} ✅ This works in template tests {% endcomment %}
{% if template contains 'product' %}
```

This works because your variant's template name is `product.sl-XXXXXXXX`, which still contains the string `product`. The `contains` check passes for both your original and variant templates.

The same fix applies to any template type:

liquid

```liquid
{% if template contains 'collection' %}
{% if template contains 'index' %}
{% if template contains 'page' %}
```

#### Where to look in your theme code

The conditional checks that cause this issue are usually in your theme's global files, not in the template itself. Search your theme files for `template ==` or `if template` .

To search your theme code, go to **Online Store** > **Themes** > **Edit code**, then use the search bar to find `template ==`.

### My variant changes are showing on my original pages too

If changes you made to your variant are also appearing on your original, this is usually the same theme code issue described in My variant looks broken or unstyled, just showing up differently.

In some cases, theme code applies logic based on the page type rather than the specific template. For example, a snippet that adds a banner to "all product pages" will affect both your original and variant because they're both product templates. The fix is the same: update your theme code to distinguish between templates using `request.page_type`, `template.suffix`, or Shopify objects.

If the changes are coming from a section that's shared across templates (like a global header or footer), those sections aren't part of the template test. Changes to shared sections affect your entire store. To test changes to shared sections, use a theme test instead.

***

**Still need help?** [Contact Shoplift support](https://support.shoplift.ai/).
