Adding the Rebuy Script Tag

By default Shopify loads all apps after the regular Shopify site has finished loading. This means Rebuy is not allowed to run until after the site has finished loading which can sometimes take 3-4 seconds or longer. We can change this by the adding Rebuy JS directly to your theme.

In your theme's theme.liquid file, add the following script tag before the closing body tag.

<script async src="https://cdn.rebuyengine.com/onsite/js/rebuy.js?shop={{ shop.permanent_domain }}"></script>

Then, turn off Rebuy JS via your settings here: Rebuy settings. Switch "Enable Rebuy JS" from "Yes to "No" and save.

1654

If Rebuy has already loaded, then it will simply return and not run through initialization again. But, it is suggested to turn off this setting so that Rebuy does not try to load in multiple times.

Only Load Rebuy.JS

It is also possible to only load in Rebuy.JS without the CSS package. This is useful if you would like to utilize your custom theme CSS.

<script async src="https://cdn.rebuyengine.com/onsite/js/rebuy.js?assets=javascript&shop={{ shop.permanent_domain }}"></script>

Only Load Rebuy CSS

It is also possible to only load Rebuy CSS without the JavaScript. This can be useful if your application is using our REST API with custom JavaScript.

<script async src="https://cdn.rebuyengine.com/onsite/js/rebuy.js?assets=stylesheet&shop={{ shop.permanent_domain }}"></script>