jag4293 Posted November 26 Posted November 26 I've seen other similar topics but the code injection wasn't working on my site. I want all of my product pages when you click "print shop" (https://www.jg-etal.com/prints/p/lilac-10x10) to link back to my Print Shop page-- "https://www.jg-etal.com/print-shop" currently it's automatically linked to the built in store page https://www.jg-etal.com/prints thank you!
tuanphan Posted November 28 Posted November 28 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> jag4293 1 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 Squareko Posted Thursday at 10:54 AM Solution Posted Thursday at 10:54 AM 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: jag4293 1
jag4293 Posted Monday at 06:48 PM Author Posted Monday at 06:48 PM Yes this worked, thank you so much!!!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment