Jump to content

change / customize the product page link

Go to solution Solved by Squareko,

Recommended Posts

Posted

You can use this code to Website Tools > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
jQuery(document).ready(function($) {
	$('a.ProductItem-nav-breadcrumb-link:first-child').attr('href','/print-shop');
});
</script>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

  • Solution
Posted

Add this code into pages > web tools > cod

<script>
    document.addEventListener("DOMContentLoaded", function() {
        // Define the current URL pattern and the redirect URL
        const currentURL = window.location.href;
        const printShopRedirect = "https://www.jg-etal.com/print-shop";

        // Check if the URL is a product page under the "prints" category
        if (currentURL.includes("/prints/p/")) {
            // Find the "Print Shop" link and override its href
            const printShopLink = document.querySelector('a[href="/prints"]');
            if (printShopLink) {
                printShopLink.href = printShopRedirect;
                printShopLink.addEventListener("click", function(e) {
                    e.preventDefault(); // Prevent default behavior
                    window.location.href = printShopRedirect; // Redirect to Print Shop
                });
            }
        }
    });
</script>

e injection > footer:

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.