Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
So the sort by feature is not working on my site (Dawn 2.3.0).
The console is saying:
Uncaught ReferenceError: debounce is not defined
at new FacetFiltersForm (facets.js?v=12346274531771569079:6:5)
Steps I have tried:
1. Copying the code in all the facets files from a fresh copy of dawn, the console still throws the error 😕
Would greatly appreciate any help in solving this issue.
Solved! Go to the solution
This is an accepted solution.
Hi Lew 2234,
I'm Richard, CRO Expert from the PageFly team. Regards your problem, it's likely that the debounce function is missing somehow. To bring it back, you may follow my instruction below.
First thing first, debounce is a very popular javascript function and if it's not supposed to be "that popular" debounce but your theme-only debounce function, adding the code below won't help. In this case, you might need to contact Shopify to resolve the issue.
1. Navigate to your online store section -> Theme -> Actions -> Edit code
2. Open theme.liquid and add the this code just below your </body> tag
<script>
function debounce(func, timeout = 300){
let timer;
return (...args) => {
clearTimeout(timer);
timer = setTimeout(() => { func.apply(this, args); }, timeout);
};
}
</script>
3. Save the file, the issue should be resolved by now. Hope this helps.
Best regards,
Richard - PageFly
Please let me know if it works by giving it a Like or marking it as a solution!
➜ Optimize your Shopify store with PageFly Page Builder (Free plan available)
All features are available from Free plan. Live Chat Support is available 24/7.
Hi @Lew2234,
Please send your site and if your site is password protected, please send me the password. I will check it.
This is an accepted solution.
Hi Lew 2234,
I'm Richard, CRO Expert from the PageFly team. Regards your problem, it's likely that the debounce function is missing somehow. To bring it back, you may follow my instruction below.
First thing first, debounce is a very popular javascript function and if it's not supposed to be "that popular" debounce but your theme-only debounce function, adding the code below won't help. In this case, you might need to contact Shopify to resolve the issue.
1. Navigate to your online store section -> Theme -> Actions -> Edit code
2. Open theme.liquid and add the this code just below your </body> tag
<script>
function debounce(func, timeout = 300){
let timer;
return (...args) => {
clearTimeout(timer);
timer = setTimeout(() => { func.apply(this, args); }, timeout);
};
}
</script>
3. Save the file, the issue should be resolved by now. Hope this helps.
Best regards,
Richard - PageFly
Please let me know if it works by giving it a Like or marking it as a solution!
➜ Optimize your Shopify store with PageFly Page Builder (Free plan available)
All features are available from Free plan. Live Chat Support is available 24/7.
Hey Richard,
Thanks for that, the code worked and the filter is now working!
I noticed the log is now throwing this error :
Uncaught ReferenceError: onKeyUpEscape is not defined
at new FacetFiltersForm (facets.js?v=12346274531771569079:13:62)
at facets.js?v=12346274531771569079:175:16
Thanks again for the help, It's greatly appreciated!
Edit* posted same comment twice by accident
Hi Lew2234,
The function onKeyUpEscape appears to be wrongly handled in FacetFiltersForm while users hit the escape (ESC) button and release it (or could be you're not pressing that button, the bug is still presenting), specifically facets.js file. This is a code-related problem, probably their bug. If you're using FacetsFilterForm, please contact them on this.
I'm glad my solution helps. 😄
Best regards,
Richard - PageFly
Please let me know if it works by giving it a Like or marking it as a solution!
➜ Optimize your Shopify store with PageFly Page Builder (Free plan available)
All features are available from Free plan. Live Chat Support is available 24/7.
still i'm getting same issue
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025