Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Re: Disable URL Redirection When Clicking On Product Image on home page

Solved

Disable URL Redirection When Clicking On Product Image on home page

ggbears2022
Tourist
4 0 1

Hi,

 

I am using the Prestige theme and would like to disable the URL redirection when clicking on the product image that's on my home page. Rather than redirecting to the product page, I'd like for the product image to do nothing at all when clicking on it, i.e. I just want to remain on the same page.

 

Thanks!

Accepted Solution (1)

BSS-Commerce
Shopify Partner
3477 463 547

This is an accepted solution.

Hi @ggbears2022 

Please follow these steps:

 

Go to Online Store > Theme > Edit Code, and find the assets folder. Then, please add the following code at the end of any JS file until the image link doesn't work. Usually, that file is called theme.js:

setTimeout(() => {
  document.querySelector(".FeaturedProduct .FeaturedProduct__Gallery").style.pointerEvents = "none"
}, 1000)

I hope that it will work for you.

If our suggestions are useful, please let us know by giving it a like, marking it as a solution, or donating here .


B2B Solution & Custom Pricing | Product Labels by BSS


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency

View solution in original post

Replies 7 (7)

GemPages
Shopify Partner
5625 1262 1254

Hello @ggbears2022 

 

You can follow these steps: 
1. Go to Online Store->Theme->Edit code

GemPages_0-1671673216484.png

2. Open your theme.liquid file, paste the below code before </body>

 

GemPages_2-1671673380898.png

    {%  if template contains 'index' %}
    <script src="https://code.jquery.com/jquery-3.6.3.min.js" integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>
    <script>
      $(document).ready(function() {
        $('.ProductItem a.ProductItem__ImageWrapper').attr("href", "javascript&colon;void(0)")
      });
    </script>
    {%  endif %}

I hope the above is useful to you.


Kind & Best regards, 
GemPages Support Team

GemPages - Build any high-converting store pages for any business


- If you find my reply helpful, please hit Like and Mark as Solution
- Get connected: App Store | Blog | Community | Help Center
ggbears2022
Tourist
4 0 1

Hi @GemPages, thanks for the response. Unfortunately, the same issue is still persisting after adding the code. I'd appreciate any other potential solutions that you may have. Thanks!

f_malik
Shopify Partner
33 7 10

Hello @ggbears2022 ,

Please share your store URL and password.
So that I will check and let you know the exact solution here.

ggbears2022
Tourist
4 0 1

Hi @f_malik, will this preview of our site suffice? https://k6pg6achah3p6wxi-68791861539.shopifypreview.com

 

thank you!

BSS-Commerce
Shopify Partner
3477 463 547

This is an accepted solution.

Hi @ggbears2022 

Please follow these steps:

 

Go to Online Store > Theme > Edit Code, and find the assets folder. Then, please add the following code at the end of any JS file until the image link doesn't work. Usually, that file is called theme.js:

setTimeout(() => {
  document.querySelector(".FeaturedProduct .FeaturedProduct__Gallery").style.pointerEvents = "none"
}, 1000)

I hope that it will work for you.

If our suggestions are useful, please let us know by giving it a like, marking it as a solution, or donating here .


B2B Solution & Custom Pricing | Product Labels by BSS


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency
ggbears2022
Tourist
4 0 1

EDIT:

 

Hi @BSS-Commerce, this worked!! Thanks so much for your help

Tele_Lam
Visitor
2 0 0

Hi, @BSS-Commerce I encounter the same problem that the it redirects to the home page when I click on the product page. How can I stop the redirect? I'm using Testament theme and couldn't find the code in the JS file you mentioned above. Can you please help?