Some merchants need the ability to disable Rebuy for certain customers or to only load Rebuy on certain themes. This guide will show you could 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.
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>.
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="https://cdn.rebuyengine.com/onsite/js/rebuy.js?shop={{ 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.
Notes: To be aware of
Customers must sign in, in order to pull in their customer tags.
We've see instances of customer tags not carrying over to product pages, in this case Rebuy will still load onto the product page because there is no tag to exclude Rebuy from loading. If you see this behavior consult with Shopify or your Theme creator to determine how to pull customer tags into your product pages.
Step 3: 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. Now copy and paste the code below just above the closing body tag </body>.
<script async src="https://cdn.rebuyengine.com/onsite/js/rebuy.js?shop={{ shop.permanent_domain }}"></script>
This will make it so Rebuy is only loading on this specific theme.