Complimentary Products code edit

Complimentary Products code edit

Kevin666
Shopify Partner
3 0 2

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.

prestige.png

 

 

 

Replies 2 (2)

goldi07
Trailblazer
147 10 16

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 😊

Was I helpful?

Buy me a coffee



Want to modify or custom changes or bug fix on store . Or Need help with your store? Or -Want Complete Storefront
Email me -Goldi184507@gmail.com - Skype: live:.cid.819bad8ddb52736c -Whatsapp: +919317950519
Checkout Some Free Sections Here
Kevin666
Shopify Partner
3 0 2

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