Jump to content

Redirect Shop Button to Hidden Page

Recommended Posts

Hi there. I've just changed my template from Montauk to Brine. On Montauk, i had a little custom code that enabled me to click on the 'shop' button and have that redirected to an unlinked page (basically a categories page that I had created) Originally on Montauk, when you clicked 'shop' it took you nowhere and only opened up the dropdown categories.

Since changing over to Brine, this link doesn't work and clicking on shop just takes me to my first product page. The code still looks as though it's in there. 

Any ideas on what i can do to get it working again?

Link to comment
  • Replies 9
  • Views 1.1k
  • Created
  • Last Reply

A link to your site would be very useful in order to determine what's going wrong with your script. 

I'm Colin Irwin aka silvabokis.  I've been a Squarespace designer & developer since 2013. 
I remember when it was all wild prairies round these here parts. 🐃🤠
Advice I give on here is free, though I may sometimes post an affiliate link or promote something I've written.
That reminds me.. ..you might want to check out my
Squarespace template finder or have a look at my other Squarespace tips
Speaking of tips, 💲I've got a tip jar that you're welcome to throw a few quid into if you think I've helped you. 
If you're looking for a Squarespace developer 
Book a chat or Drop me a line - first meeting is always free  

 

Link to comment

This was the code that worked with Montauk up until I changed template earlier today...

 

 <script>
  $(function() {
    $('.main-nav li a').each(function () {
  if ($(this).text() == 'Shop') {
  $(this).attr('href','https://littleanvil.com/categories/');
  $(this).attr('onclick','true');
  }
    });
  });
  </script>

Link to comment

Do you have a script tag anywhere that calls in jQuery?

I'm Colin Irwin aka silvabokis.  I've been a Squarespace designer & developer since 2013. 
I remember when it was all wild prairies round these here parts. 🐃🤠
Advice I give on here is free, though I may sometimes post an affiliate link or promote something I've written.
That reminds me.. ..you might want to check out my
Squarespace template finder or have a look at my other Squarespace tips
Speaking of tips, 💲I've got a tip jar that you're welcome to throw a few quid into if you think I've helped you. 
If you're looking for a Squarespace developer 
Book a chat or Drop me a line - first meeting is always free  

 

Link to comment

You should try replacing your current script with the following

<script>
window.Squarespace.onInitialize(Y, function(){
	$('.Header-nav-folder-title[href = "/shop"]').attr('href', '/categories/');
});
  </script>

 

I'm Colin Irwin aka silvabokis.  I've been a Squarespace designer & developer since 2013. 
I remember when it was all wild prairies round these here parts. 🐃🤠
Advice I give on here is free, though I may sometimes post an affiliate link or promote something I've written.
That reminds me.. ..you might want to check out my
Squarespace template finder or have a look at my other Squarespace tips
Speaking of tips, 💲I've got a tip jar that you're welcome to throw a few quid into if you think I've helped you. 
If you're looking for a Squarespace developer 
Book a chat or Drop me a line - first meeting is always free  

 

Link to comment

Great question! I have a similar one..

Colin, is there a script I can use so that  an "add to cart" (.sqs-add-to-cart-button-wrapper) button does nothing when clicked on (ie. does not add anything to a cart or change text)? I'd like to change the text on these buttons to "Please Call ##" and make them unclickable.

Thank you!!!

Rachel

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.