All Collections
How to conditionally load Rebuy for certain users or on specific themes only
How to conditionally load Rebuy for certain users or on specific themes only

A guide for choosing where Rebuy is installed and which customers can access Rebuy features.

Jason Khan avatar
Written by Jason Khan
Updated over a week ago

Some merchants need the ability to disable Rebuy for certain customers or to only load Rebuy on certain themes. This guide will show how you can achieve both of these goals. To begin, follow the first part of this help doc for toggling off Rebuy JS from within the Rebuy Admin.

Loading Rebuy only for certain users

Step 1: Access the theme.liquid file for the store in question

After logging into the Shopify Admin for your store, open the specific theme you're working in and search for the theme.liquid file. This is the file we'll be working in, next scroll down until you locate the closing body tag </body>.

Protip: you can use control + f or cmd + f to search for </body>

Step 2: Blocking Rebuy for Specific users

If you'd like to block Rebuy for certain customers, you'll first need to tag those customers with a common tag. Example: 'wholesale"

Then you can copy and paste the code below into your theme.liquid file, just above the closing body tag </body>.

{% unless customer.tags contains 'insert tag here' %}

<script async src="{{ shop.permanent_domain }}"></script>

{% endunless %}

Update the first line to include the customer tag you're using.

{% unless customer.tags contains 'wholesale' %}

This code will only load Rebuy onto your theme for customers who do NOT have that tag assigned to them.

Important Considerations

  1. Customers must be signed in, in order to pull in their customer tags.

  2. We've see instances of customer tags not carrying over to product pages, in this case Rebuy will still load onto the product page. If you see this behavior consult with Shopify or your Theme creator to determine how to pull customer tags onto your product pages.

  3. If you're using App blocks to install widgets, that will also load Rebuy at the same time. You'll need to remove the App blocks and manually install your widgets in your theme files instead.

  4. If you have the Rebuy load Script elsewhere in your theme files, this approach will not work. Rebuy will continue to load regardless of customer tag. The Rebuy load Script should only exist in your theme files via the snippet above.

If you'd like to keep Rebuy running for your B2B users please follow this article for how to integrate Rebuy with your B2B store.

Loading Rebuy on specific themes only

This can be very helpful for merchants who want to test Rebuy products without impacting their current live theme.

First, login to your Shopify Admin and access the theme.liquid file for the theme you want Rebuy to load into.

Protip: you can use control + f or cmd + f to search for </body>

Now copy and paste the code below just above the closing body tag </body>.

<script async src="{{ shop.permanent_domain }}"></script>

This will allow Rebuy to only load on this specific theme.

Did this answer your question?