Highlight your online products by activating a lightbox when a customer clicks a product image.
This customization enables a lightbox for your website images. When an image is clicked, it’s displayed as a highlighted overlay on the current page, while the rest of that page content is darkened and disabled.
You need a theme that already uses a lightbox plugin on product pages. You can find out if your theme uses one, by going to a product page on your storefront and clicking on your main product image. If the image opens up in a centered box on the screen with the background dimmed, then you have a lightbox.
Common lightbox plugins used by Shopify themes are:
For this functionality, we’ve used fancybox for the lightbox feature.
theme.liquid
file, locate the ending </head>
tag and add the following code right above the </head>
tag, if you’re theme already using jQuery then you don’t have to add the first script from the following code:&amp;lt;script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" /&amp;gt; &amp;lt;script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"&amp;gt;&amp;lt;/script&amp;gt;
product.lightbox.liquid
and add the following code :{% comment %} The contents of the product.liquid template can be found in /sections/product-lightbox-template.liquid {% endcomment %} {% section 'product-lightbox-template' %} {% section 'product-recommendations' %} {% if collection %} &amp;lt;div class="text-center return-link-wrapper page-width"&amp;gt; &amp;lt;a href="{{ collection.url }}" class="btn btn--secondary btn--has-icon-before return-link"&amp;gt; {% include 'icon-arrow-left' %} {{ 'products.product.back_to_collection' | t: title: collection.title }} &amp;lt;/a&amp;gt; &amp;lt;/div&amp;gt; {% endif %} &amp;lt;script&amp;gt; // Override default values of shop.strings for each template. // Alternate product templates can change values of // add to cart button, sold out, and unavailable states here. theme.productStrings = { addToCart: {{ 'products.product.add_to_cart' | t | json }}, soldOut: {{ 'products.product.sold_out' | t | json }}, unavailable: {{ 'products.product.unavailable' | t | json }} } &amp;lt;/script&amp;gt; {% assign current_variant = product.selected_or_first_available_variant %} &amp;lt;script type="application/ld+json"&amp;gt; { "@context": "http://schema.org/", "@type": "Product", "name": {{ product.title | json }}, "url": {{ shop.url | append: product.url | json }}, {%- if product.featured_image -%} {%- assign image_size = product.featured_image.width | append: 'x' -%} "image": [ {{ product.featured_image.src | img_url: image_size | prepend: "https:" | json }} ], {%- endif -%} "description": {{ product.description | strip_html | json }}&amp;lt;div class="esc-size-matters-preinstall" id="preinstall-7ffb5462b49233964aeec674cf251220"&amp;gt;&amp;lt;/div&amp;gt;, {%- if current_variant.sku != blank -%} "sku": {{ current_variant.sku | json }}, {%- endif -%} "brand": { "@type": "Thing", "name": {{ product.vendor | json }} }, "offers": [ {%- for variant in product.variants -%} { "@type" : "Offer", {%- if variant.sku != blank -%} "sku": {{ variant.sku | json }}, {%- endif -%} "availability" : "http://schema.org/{% if product.available %}InStock{% else %}OutOfStock{% endif %}", "price" : {{ variant.price | divided_by: 100.00 | json }}, "priceCurrency" : {{ cart.currency.iso_code | json }}, "url" : {{ shop.url | append: variant.url | json }} }{% unless forloop.last %},{% endunless %} {%- endfor -%} ] } &amp;lt;/script&amp;gt;
Imagine! Seamlessly connecting the vast customer base of eBay with the robust features of your…
Let’s face it. Running an online store requires unwavering discipline. Juggling multiple tasks simultaneously is…
There’s no denying that Shopify has taken over the world. The ecommerce platform contributes to…
It’s true. Every marketing strategy has one common objective: to drive maximum conversion rates. If…
*Sigh*. Are you tired of trying out different methods of making money online? Hear it…
When driving traffic to your Shopify store, Search Engine Optimization (SEO) is the most affordable…