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.
- In Shopify, go to Online Store → Themes and prepare your draft theme (do not publish it).
- Open the Edit code page of the draft theme. The theme ID is part of the URL, for example
themes/123456789. - In ABlyft, create a variation of the type Shopify Theme, see Variations.
- 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.
- In your theme, create the alternative template, for example
product.alternate.liquidorproduct.alternate.json. - In ABlyft, create a variation of the type Shopify Template.
- 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.liquidenteralternate. - 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 only | Test variant in Shopify | |
|---|---|---|
| What changes | Only the price shown in the shop | The real price, also in the cart and the checkout |
| Setup in Shopify | None, only check the stored price | An extra option with test variants per product |
| What you can measure | Mainly the add-to-cart rate | Add-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:
- Create a variation of the type Shopify Price, see Variations.
- Under Mode, choose Change displayed price only.
- 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/, forhttps://your-shop.com/products/snowboardit issnowboard. - Under Price change, choose one of:
- New price: the new price in the base currency of your shop, for example
650.00or650,00. - Change in %: a percentage applied to the price of every variant of the product, for example
10for 10 % more or-10for 10 % less.
- New price: the new price in the base currency of your shop, for example
- 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:
- Open Products and click the product.
- In the Variants card, click Add options like size or color, or Add another option if the product already has options.
- As Option name, enter exactly
ablyft-price-test. - As Option values, enter
controlandvariation. Click Done. - Shopify now creates every combination with the existing options, for example
41 / control,41 / variation,42 / controland42 / variation. - Give every
controlvariant the current price and everyvariationvariant the test price. - Check the inventory: both groups have their own stock. Give the
variationvariants the same stock as thecontrolvariants, or turn off Track quantity or turn on Continue selling when out of stock for them. - 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:
- Create a variation of the type Shopify Price.
- Under Mode, choose Test variant in Shopify, and under Role of this variation choose Test price (variation).
- Click Add product for every product and enter its handle or URL. Save.
- Open the Original variation of the experiment and set its type to Shopify Price as well.
- 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.
Related
For developers: the underlying functions are shopifyPreviewTheme, shopifySwitchTemplate and shopifyPrice in the
JavaScript tools.