Jump to content

Search block customization with code

Recommended Posts

Posted (edited)

<script>
    document.addEventListener('DOMContentLoaded', function() {
        // Locate the search bar and product prices
        var searchBar = document.querySelector('.squarespace-search');
        var productPrices = document.querySelectorAll('.product-price'); // Update this selector

        // Add prices to the search results
        productPrices.forEach(function(price) {
            searchBar.innerHTML += '<div>' + price.textContent + '</div>';
        });
    });
</script>

 

 

 

I can’t get this to work can somebody please help me, I’m doing this from a iPad so i can’t view the browsers Developers tool. I would simply like to show the price next to products in the search block

https://tarantula-buffalo-h2sj.squarespace.com/cash-pro-rennes

Many Thanks 

Jacob 

Edited by Jsim
  • Replies 5
  • Views 1.3k
  • Created
  • Last Reply

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.