Unlock Custom Product Highlights on Your Shopify 2.0 Theme (Like Smile!) with This Code Snippet
Hey everyone! As a Shopify expert who spends a lot of time diving into the community forums, I often come across fantastic discussions where store owners are trying to push the boundaries of their themes. One recent thread caught my eye because it perfectly illustrates how powerful a little custom code and some community collaboration can be.
The original post came from @saqlain1, who was using the "Smile" theme and wanted to add a really specific, branded section to their product pages. They had a clear vision: a set of "product highlights" – think small icons with short labels – that, when clicked, would pop up with more detailed information. And of course, they wanted it to match their brand's primary color, #0B283D, and look super professional. They even shared a screenshot to show exactly what they were aiming for:
This is a common request! Many themes, even great ones like Smile, might not have every single feature you envision right out of the box. That's where custom sections come in, and the community really shone in this thread.
The Community Steps In: From "URL Please" to "Here's the Code!"
Initially, a few helpful folks like @websensepro and @Mustafa_Ali asked for the store URL. This is a super standard and often necessary first step when diagnosing theme issues, as it lets experts inspect the live site. However, @alaattincagil jumped in with a brilliant insight: for this particular request, a store URL wasn't actually needed! Why? Because the solution could be built as a standalone Shopify 2.0 section, making it universally applicable to any modern theme, including Smile.
This is a key takeaway for all of us: sometimes, the solution isn't about tweaking existing theme files, but about creating something entirely new and self-contained that you can then drop into place. It’s a more robust and future-proof approach.
Building Your Own Product Highlights Section
So, how do you get this exact product highlights section with interactive popups onto your Shopify store? @alaattincagil provided a complete, ready-to-use code snippet that you can implement yourself. It's designed to be a fully customizable section that you can manage right from your theme editor.
Step-by-Step Implementation:
- Access Your Theme Code: From your Shopify admin, go to Online Store > Themes. Find your current theme, click the … (three dots) button, and then select Edit code.
- Create a New Section: In the left sidebar, under the sections directory, click “Add a new section”.
- Name Your Section: Name it
product-highlights. - Paste the Code: Replace everything inside the newly created
product-highlights.liquidfile with the following code. Make sure to copy it exactly, including theand{% schema %} { "name": "Product highlights", "settings": [ { "type": "text", "id": "heading", "label": "Heading", "default": "Highlights" }, { "type": "color", "id": "brand_color", "label": "Brand color", "default": "#0B283D" }, { "type": "color", "id": "icon_bg", "label": "Icon circle color", "default": "#E3ECF2" } ], "blocks": [ { "type": "highlight", "name": "Highlight", "settings": [ { "type": "image_picker", "id": "icon", "label": "Icon" }, { "type": "text", "id": "title", "label": "Title", "default": "Clean Ingredients" }, { "type": "richtext", "id": "text", "label": "Popup text", "default": "Write a short explanation here.
" }, { "type": "url", "id": "link", "label": "Button link" }, { "type": "text", "id": "link_label", "label": "Button label", "default": "Learn more" } ] } ], "presets": [{ "name": "Product highlights" }] } {% endschema %}- Save the File: Click Save.
- Add to Your Product Template: Now, go back to your Shopify admin and click Online Store > Themes > Customize. Open any product page in the editor. In the left sidebar, under "Product information" (or wherever you want it to appear on your product page), click “Add section” and select “Product highlights”.
- Configure Your Highlights: Once added, you can click on the "Product highlights" section. You'll see options to add individual "Highlight" blocks. For each block, you can upload an icon (small, transparent PNG or SVG files work best for those neat circles!), set a title, write the detailed popup text (using rich text!), and even add an optional "Learn more" link with its own label. You can also adjust the main heading, brand color, and icon circle color for the entire section.
What Makes This Solution So Good?
- Shopify 2.0 Native: It leverages the power of Shopify's Online Store 2.0 architecture, meaning it's a true section that integrates seamlessly with your theme editor.
- No Apps Needed: The popup functionality uses the browser's built-in
element. This is fantastic because it means no extra apps to install, no monthly fees, and minimal impact on your store's performance. The popups will close naturally with the "x" button, a click outside, or the Esc key. - Fully Customizable: You get control over the heading, brand color, icon background color, and individual highlight content (icon, title, popup text, link) directly from the theme customizer. This makes it super easy to match your brand, just like @saqlain1 wanted for their #0B283D brand color.
- Flexible Placement: While designed for product pages, as @alaattincagil mentioned, if you wanted it under the product description instead of a broader product area, it’s possible to adjust its placement.
This whole exchange is a perfect example of the Shopify community at its best – store owners asking for specific needs and experts stepping up with elegant, code-based solutions that empower everyone. It’s a reminder that with a little Liquid, CSS, and JavaScript, you can really tailor your Shopify store to stand out and provide an exceptional experience for your customers, all without relying on a ton of external apps. Always remember to test custom code on a duplicate of your theme first, just to be safe!
