Dynamite

How to add custom code to a Shopify theme

A site-wide script on Shopify goes in the theme’s layout file, layout/theme.liquid. That file wraps every storefront page except checkout. The edit is one pasted line, and on the live theme it takes effect the moment you save.

Before you start

Steps

Check it worked

What goes wrong

Increase conversions on your Shopify store by 20%

Dynamite personalizes the page for every visitor. Dynamite personalizes a Shopify storefront from one script line in theme.liquid. Because that file stops at checkout, it neither reads nor changes anything there.

Dynamite for Shopify

Questions

Does a script in theme.liquid run on checkout pages?

No. Shopify applies theme layouts to non-checkout pages only. Checkout tracking uses pixels set up under Customer events.

Will updating my theme remove the script?

It can. Check the line in layout/theme.liquid after each update.

How do I remove the script?

Delete the line and save. The file’s Timeline also has Restore contents, which takes the file back to an earlier version.