File: /home/p8pyefaexf70/www/wp-content/uploads/custom-css-js/4647.js
<!-- start Simple Custom CSS and JS -->
<script type="text/javascript">
/* Default comment here */
document.addEventListener("DOMContentLoaded", function () {
const categoryLinks = document.querySelectorAll('a[href*="/product-category/"]');
categoryLinks.forEach(link => {
const href = link.getAttribute("href");
const match = href.match(/\/product-category\/([^\/?#]+)/);
if (match) {
const slug = match[1];
const currentURL = window.location.pathname;
// Replace link with query param format
link.setAttribute("href", `${currentURL}?category=${slug}`);
}
});
});
</script>
<!-- end Simple Custom CSS and JS -->