Use ABlyftExperiments

Shopify variations

Test a draft theme, an alternative template or different prices in your Shopify store.

If your website runs on Shopify, you can test whole themes, page templates or prices without writing code. ABlyft offers three variation types for it: Shopify Theme, Shopify Template and Shopify Price.

Before you start, the ABlyft snippet must be installed in your Shopify theme, and the experiment needs a page and a goal like any other experiment.

Shopify Theme

Shows a draft theme of your store to a part of your customers before you publish it.

  1. In Shopify, go to Online Store → Themes and prepare your draft theme (do not publish it).
  2. Open the Edit code page of the draft theme. The theme ID is part of the URL, for example themes/123456789.
  3. In ABlyft, create a variation of the type Shopify Theme, see Variations.
  4. In the section Shopify Theme, enter the Draft theme ID (numbers only, up to 12 digits) and save.

When a visitor is assigned to the variation, the snippet waits until Shopify is available on the page. If the visitor does not see the draft theme yet, the snippet redirects to the preview of that theme and hides Shopify's preview bar.

Shopify Template

Shows an alternative template of a page type, for example a second product page layout. It works with all page types: product, collection, page, blog, article, cart, search and customers.

  1. In your theme, create the alternative template, for example product.alternate.liquid or product.alternate.json.
  2. In ABlyft, create a variation of the type Shopify Template.
  3. In the section Shopify Template, enter the Template name. Only the part between the page type and the file ending is used. For product.alternate.liquid enter alternate.
  4. Save.

The snippet then reloads the page with the parameter ?view=alternate, which makes Shopify render the alternative template. If the page already has a view parameter, the snippet does not redirect.

Template and theme must exist

ABlyft does not check whether the theme ID or the template exists in your store. Preview the variation (see below) before you start the experiment.

Shopify Price

Tests different prices for one or more products without writing code. You add one row per product to the variation.

Choose a mode

The mode applies to the whole variation. Choose it first, because the setup in Shopify differs.

Change displayed price onlyTest variant in Shopify
What changesOnly the price shown in the shopThe real price, also in the cart and the checkout
Setup in ShopifyNone, only check the stored priceAn extra option with test variants per product
What you can measureMainly the add-to-cart rateAdd-to-cart, orders and revenue

Change the displayed price

The visitors of the variation see a different price on the product page and on product cards. The cart and the checkout always charge the price stored in Shopify.

In Shopify: store the lower of the two prices you want to test. That way no customer pays more than the price shown to them. Nothing else has to be set up.

In ABlyft:

  1. Create a variation of the type Shopify Price, see Variations.
  2. Under Mode, choose Change displayed price only.
  3. Click Add product and enter the Product handle. You can also paste the product URL, ABlyft takes the handle from it. The handle is the part after /products/, for https://your-shop.com/products/snowboard it is snowboard.
  4. Under Price change, choose one of:
    • New price: the new price in the base currency of your shop, for example 650.00 or 650,00.
    • Change in %: a percentage applied to the price of every variant of the product, for example 10 for 10 % more or -10 for 10 % less.
  5. Add more products if needed, then save.

The Original variation stays of the type Unchanged.

Currencies

A New price is only applied in the base currency of your shop. Visitors who browse in another currency see the normal price. A Change in % works in every currency.

Test a real price with a test variant

The product gets test variants in Shopify that carry the test price. ABlyft shows each visitor the variants of their group and makes sure the right variant ends up in the cart. Customers pay the price they see.

In Shopify, for every product in the test:

  1. Open Products and click the product.
  2. In the Variants card, click Add options like size or color, or Add another option if the product already has options.
  3. As Option name, enter exactly ablyft-price-test.
  4. As Option values, enter control and variation. Click Done.
  5. Shopify now creates every combination with the existing options, for example 41 / control, 41 / variation, 42 / control and 42 / variation.
  6. Give every control variant the current price and every variation variant the test price.
  7. Check the inventory: both groups have their own stock. Give the variation variants the same stock as the control variants, or turn off Track quantity or turn on Continue selling when out of stock for them.
  8. Click Save.

Every combination of the other options must exist in both groups. If 42 / variation is missing, visitors of the variation keep the 42 / control variant and its price.

In ABlyft:

  1. Create a variation of the type Shopify Price.
  2. Under Mode, choose Test variant in Shopify, and under Role of this variation choose Test price (variation).
  3. Click Add product for every product and enter its handle or URL. Save.
  4. Open the Original variation of the experiment and set its type to Shopify Price as well.
  5. Choose Test variant in Shopify, then Original price (control), and add the same products. Save.

Both variations are needed: the Original makes sure its visitors see and buy the control variants.

On the page, ABlyft then selects the variant of the visitor's group, hides the option ablyft-price-test, shows the right prices and links on product cards, and replaces a variant of the other group when it is added to the cart.

Visible without ABlyft

Visitors without the ABlyft snippet, for example because of an ad blocker, and product feeds such as Google Shopping see the option ablyft-price-test and both prices. Remove the option or the test variants in Shopify when the test is over.

Where prices are replaced

  • Everywhere the product is linked: on its product page, on product cards, in recommendations, in content loaded later and in quick add.
  • Never in the cart, the cart drawer or the checkout.
  • Other products stay unchanged, even if they happen to have the same price. A product that is part of the same variation gets its own price.
  • Until the prices are replaced, they are hidden for a moment, at most 1.5 seconds.
  • A wrong handle or a missing option only affects that product. All other products of the variation still work.

Own code

The fields for your own JavaScript and CSS stay available in this type, for example to show a badge or a note next to the price. Your code runs right away and does not wait for the prices. If it depends on the replaced prices, wait for them:

ablyftTools.shopifyPrice().then((results) => {
  // the prices are replaced here
});

Preview and goals

  • Use Show in browser in the menu of the variation, or the preview of the experiment, to check how the theme or template looks. See Preview & QA.
  • Goals work as in every other experiment. See Goal types. For purchases and revenue in Shopify, ABlyft supports order tracking through a webhook or through the Customer Event pixel, see Shopify tracking.
  • For Shopify Price: with the debug mode on, the browser console shows which prices were replaced and which price elements were found but not replaced.

For developers: the underlying functions are shopifyPreviewTheme, shopifySwitchTemplate and shopifyPrice in the JavaScript tools.

Next steps

On this page