All things Shopify and commerce
Hi there,
Could someone please help me. Currently, customers have to click on a little button on the top left hand side of my product image for it to open. Is there a way I can make it open if they click on anywhere in the image? URL: https://salourlingerie.com/products/rochelle-bodysuit
My theme is drop.
Thanks!
Hi, yes. I think the simplest way is to add a custom JS snippet in some JS or the liquid file (theme.liquid).
<script>
document.querySelectorAll(".product__image").forEach((img) => {
img.addEventListener("click", () => {
document.querySelector(".js-zoom-btn").click();
});
});
</script>
Step 1: Go to Admin -> Online store -> Theme > Edit code
Step 2: Search for the file theme.liquid
Step 3: Add this code before </body> tag
<script>
document.addEventListener("DOMContentLoaded", (event) => {
const productGalleryContainers = document.querySelectorAll('.product-gallery__media-container');
if (productGalleryContainers.length) {
productGalleryContainers.forEach((productGalleryContainer) => {
const productImg = productGalleryContainer.querySelector('.product__image');
productImg.addEventListener('click', () => {
productGalleryContainer.querySelector('a.js-zoom-btn.product-gallery__zoom-btn').click();
});
});
}
});
</script>
B2B Wholesale Solution: Streamline your B2B operation with advanced features like wholesale registration forms, custom pricing.
B2B Portal, Quote, Net 30: Speed up purchasing and streamline your quotation process with advanced features like quick order, request for quote.
B2B Lock Password Protect: Easily control access to pages, products, and pricing with robust features.
BSS Commerce - Full-service eCommerce Agency I Use Shopify for 1$ in the first month now
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024