Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi folks, I'm not sure if this is possible (I asked the theme developers, but they are never very helpful with any code tweaks).
So my site is built on the Prestige theme and I am looking for a way to tweak the complimentary products you will see on this link so that if the visitor clicks on the product images or title nothing happens... I want them to have to click on the Add To Cart button so the pop-up opens and they do not leave the original product.
I have tried editing the code myself, with the basics I thought might work, but not working.
You can visit this example link to see what I mean also https://hunterscottishartist.art/products/brodgar-moonlight-orkney-art-prints
Thanks a lot either way 🙂
Kev.
Hello @Kevin666
Since you're using the Prestige theme, you'll need to modify the complimentary products section in your theme code to prevent the product image and title from being clickable while keeping the "Add to Cart" button functional.
Steps to Achieve This:
1. Locate the Code
. Go to Online Store > Themes > Edit Code.
. Find the relevant Liquid file that renders complimentary products. In Prestige, this is likely in snippets/product-recommendations.liquid or a similar file.
2. Modify the Anchor Tags
. Look for <a> tags wrapping the product image and title. They will likely link to {{ product.url }}.
. Remove the href attribute or replace it with # to disable navigation.
3. Disable Click Events with JavaScript
. Add this script in theme.js or directly in the Liquid file:
document.addEventListener("DOMContentLoaded", function() {
document.querySelectorAll('.complimentary-products a').forEach(anchor => {
anchor.addEventListener('click', function(event) {
event.preventDefault();
});
});
});
. Ensure the .complimentary-products class matches the correct section in your theme.
Thank you 😊
Hi Goldi, thanks so much for this. SOrry for delay in getting back to you. I was away for a few nights. I will get trying this today. Thanks again you are a star :). Kevin
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025