Skip to main content
All CollectionsSmart Search
Disable Rebuy Smart Search based on theme
Disable Rebuy Smart Search based on theme

A guide showing how you can choose which theme(s) Rebuy Smart Search is active on

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

Rebuy Smart Search is a powerful tool which you can leverage to enhance your customers shopping experience and help drive revenue.

For full details on what Smart Search is, how it works, and how you can set it up, please begin with this help document.

Why might this be necessary?

Once Smart Search is turned on in the Rebuy Admin it will be live across all themes that have Rebuy installed. This allows for seamless mirroring across themes, your live theme will match any other themes in your theme library that also have Rebuy installed.

However some merchants require the ability to segment their themes. For example, only allowing Smart Search to load onto a testing theme while the live theme remains unchanged. This help document addresses that need.

Add code to the theme files to disable Rebuy Smart Search

Within the theme(s) where you do not want to have Rebuy Smart Search active, access the theme.liquid file and scroll down to the closing body tag </body>.

If needed you can keyword search for </body>.

Just above the closing body tag, paste the following code and click save.

 <script> 
/* check for Rebuy quick view and if active, disable it */
document.addEventListener('rebuy:smartsearch.quickview.ready', (event) => {
console.log(event.detail.smartSearchQuickView, "Quickview is ready");

Rebuy.SmartSearch.quickView.quickViewSettings.setting.enabled = false;
console.log(`Rebuy Search quick view enabled = ${Rebuy.SmartSearch.quickView.quickViewSettings.setting.enabled}`)
})

/* check for Rebuy results page and if active, disable it */
document.addEventListener('rebuy:smartsearch.resultsPage.ready', (event) => {
console.log(event.detail.smartSearchResultsPage, "Results Page ready");

Rebuy.SmartSearch.resultPage.isVisible = false;
console.log(`Rebuy Search results page enabled = ${Rebuy.SmartSearch.resultPage.isVisible}`)
})
</script>


Rebuy Smart Search is comprised of 2 main components, quick view and the results page. The code above will disable both but they can also be disabled individually if needed.

Example: You're already using the Smart Search results page on your live theme and are now testing quick view.

Disable quick view only

 <script> 
/* check for Rebuy quick view and if active, disable it */
document.addEventListener('rebuy:smartsearch.quickview.ready', (event) => {
console.log(event.detail.smartSearchQuickView, "Quickview is ready");

Rebuy.SmartSearch.quickView.quickViewSettings.setting.enabled = false;
console.log(`Rebuy Search quick view enabled = ${Rebuy.SmartSearch.quickView.quickViewSettings.setting.enabled}`)
})
</script>

Disable results page only

 <script>   
/* check for Rebuy results page and if active, disable it */
document.addEventListener('rebuy:smartsearch.resultsPage.ready', (event) => {
console.log(event.detail.smartSearchResultsPage, "Results Page ready");

Rebuy.SmartSearch.resultPage.isVisible = false;
console.log(`Rebuy Search results page enabled = ${Rebuy.SmartSearch.resultPage.isVisible}`)
})
</script>

All code shown must be placed above the closing body tag </body>.

Set up and activate Rebuy Smart Search

The code shown above will disable Smart Search in any theme it is placed into.

Next you simply need to access Rebuy Admin and begin setting up Smart Search as desired. When you're ready, set Smart Search to live mode and it will automatically be active in any theme that has Rebuy installed and does not have the code shown above.

For assistance with customizing and enabling Smart Search, please review the help documents below.

Did this answer your question?