Search bar for my WIX store

Hi, I am trying to use the wix stores template (rather than create my own repeater, as the filters and sort are built in already which saves time, as well as the cart page, thank you page all being linked etc)

I have written some code for a search bar and tested it on a test repeater I created myself, and it works fine. When i then try and add the code to the ‘Shop’ page of my wix stores, i get no errors but the search just doesnt work. I have put the code below.

Any ideas? Thanks

import wixData from ‘wix-data’;
$w.onReady( function () {
});

let lastFilterName;
let debounceTimer;

function filter(name) {
if (lastFilterName !== name) {
let newFilter = wixData.filter();
if (name)
newFilter = newFilter.contains(“name”, name);
$w(“#dataset1”).setFilter(newFilter);
lastFilterName = name;
}
}
export function search_keyPress(event) {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w(“#search”).value, lastFilterName)
})
}

Hello.

Do you want to use the filter on Wix Stores’ product gallery? If this is the case, kindly note that Corvid and built-in Wix Stores elements are not yet integrated.

To apply custom filters on Wix Stores, you need to use a dynamic page or connect your dataset to a repeater, table or gallery.

Good luck!