Theme Development

Many merchants, theme developers, and development teams will push updates to live and unpublished themes through Git to manage versions of their themes.

If your team uses Git to control and publish new versions of your themes, there are a few important things to know to ensure you don't run into issues when running tests with Shoplift.

Ensure any changes to your theme are pulled down to your repository prior to pushing updates

Many times merchants and apps will make changes to the theme or theme assets through the Theme Editor or Asset APIs.

At Shoplift, we attempt to mitigate the frequency with which we do this. Occasionally, we will ship updates to our shoplift.liquid snippet, and while we make efforts to make these updates backwards compatible, there could be issues if the current version of the snippet is accidentally overwritten or restored to an outdated or previous version.

We recommend always pulling down the latest changes to your theme prior to pushing any updates from Git to ensure the latest version of the snippet is present.

In the case that the snippet is removed, overwritten, or modified, Shoplift will attempt this and correct the issue every hour. We will also perform this check any time an entirely new main theme is published.

Ensure the Shoplift snippet exists and is referenced in the <head> of your theme.liquid

For the Shoplift script to function correctly, it must exist in the themes snippets directory (shoplift.liquid) and must be referenced in the <head> of your theme.liquid via a render tag. Whenever making updates or changes to your theme, double check to ensure that both the snippet and the render tag are present in your theme directory.

Possible issues if the Shoplift snippet is outdated, modified, or removed

  • All tests cease to collect visitor data until the script is restored, as there would be no way for Shoplift to track and collect essential visitor events

  • If running theme tests, theme preview bars could show on the B side themes until the script is restored, as there would be no way for Shoplift to suppress it

  • If running theme tests, website visitors could get stuck on the preview theme until the script is restored, as there would be no way for Shoplift to return visitors to the main theme when necessary

How to solve issues previewing themes included in previous theme tests

If you are running into issues previewing themes that were previously included in theme tests, it could be because:

  • your browser was previously assigned to the B side of the test, and the Shoplift script is returning you to the main theme, as it would do for a website visitor

  • you do not have a Shoplift local storage item or cookie in your browser, and the Shoplift script is returning you to the main theme, as it would for a website visitor

To resolve this, you will need to first clear out your existing Shoplift tracking items in your browser storage, and then receive new tracking items, which will no longer have the test association for the theme you are trying to preview.

  1. Open up the developer tools window in your browser. In Chrome, the shortcut for this is CMD + Shift + C on MacOS.

  2. Within this window, click the tab titled "Application" (depending on your browser, this may also be called "Storage") and locate your local storage.

  3. In your local storage you can find an item called SHOPLIFT_SESSION. Delete this item from your local storage.

  4. Then navigate to your cookies, where you will find a cookie called SHOPLIFT. Delete this cookie.

  5. Once this browser storage is cleared, navigate to your main theme to receive new Shoplift tracking items in your browser storage. Alternatively, if you attempt to preview a theme and don't have any Shoplift tracking items in your browser, you will be returned to the main theme exactly one time to add a fresh tracking cookie and local storage item.

  6. Once you have a fresh tracking cookie and local storage item, you will be able to preview the theme without issue.

Please note that if you delete only one storage method (local storage or cookie) then the deleted item will be regenerated by the other, and your tracking will not be completely cleared.

These protections are in place to ensure website visitors do not persist on preview themes outside of a test's duration, or in the event that their browser storage was cleared. We are exploring methods to make this workflow more easy for developers who need to consistently preview themes.

Last updated