
Product Results
Provides a visual breakdown of customer survey data using animated circular progress charts. The charts utilize a CSS conic-gradient and scroll-triggered JavaScript to animate percentages when the user reaches the section.
- Scroll-triggered animations
- Pure CSS circular gauges using conic-gradients
- Mobile-responsive flexbox layout
- Automatic percentage counter incrementing
- Configurable data-target attributes for stats
- Displaying clinical trial results on health product pages.
- Showing customer satisfaction survey percentages.
- Highlighting product performance benchmarks against competitors.
- Building a 'Why Choose Us' section with quantitative data.
- Shopify Online Store 2.0
- Most Shopify themes
The code
1<!DOCTYPE html>2<html lang="en">3<head>4 <meta charset="UTF-8">5 <meta name="viewport" content="width=device-width, initial-scale=1.0">6 <title>Cricket Stats Chart</title>7 <style>8 .circular-chart {9 position: relative;10 width: 80px;11 height: 80px;12 min-width: 80px;13 min-height: 80px;14 border-radius: 50%;15 background: conic-gradient(16 from 0deg,17 #1cbcc3 0%,18 #4abf8f calc(var(--percentage) / 2),19 #66bb6a var(--percentage),20 #ccc 0%21 );22 flex-shrink: 0;23 }24 .circular-chart::after {25 content: "";26 position: absolute;27 top: 11%;28 left: 11%;29 width: 78%;30 height: 78%;31 background: white;32 border-radius: 50%;33 }34 .percentage {35 position: absolute;36 top: 50%;37 left: 50%;38 transform: translate(-50%, -50%);39 font-size: 18px;40 font-weight: bold;41 z-index: 1;42 }43 .satisfaction-container {44 width: 100%;45 display: flex;46 align-items: center;47 gap: 15px;48 flex-wrap: nowrap;49 justify-content: flex-start;50 border-bottom: 1px solid #dddddd;51 padding: 0px 0px 10px 0px;52 }53 .satisfaction-container:nth_child(1) {54 border-bottom: 1px solid #dddddd;55 border-top: 1px solid #dddddd;56 padding: 10px 0px 10px 0px;57 }58 .satisfaction-text {59 font-size: 15px;60 font-weight: 500;61 flex-grow: 1;62 white-space: normal;63 }64 .stats-container {65 display: flex;66 flex-direction: column;67 gap: 10px;68 justify-content: center;69align-items: center;70 max-width: 600px;71 margin: auto;72 }73 @media (max-width: 600px) {74 .satisfaction-container {75 width: 100%;76 display: flex;77 align-items: center;78 gap: 15px;79 flex-wrap: nowrap;80 justify-content: flex-start;81 border-bottom: 1px solid #dddddd;82 padding: 0px 10px 10px 10px;83 }84 .satisfaction-container: nth_child(1) {85 border-bottom: 1px solid #dddddd;86 border-top: 1px solid #dddddd;87 padding: 0px 10px 10px 10px;88 }89 .circular-chart {90 width: 65px;91 height: 65px;92 min-width: 60px;93 min-height: 60px;94 }95 .percentage {96 font-size: 16px;97 }98 }99 </style>100</head>101<body>102 <div class="stats-container">103 <h2 style = "font-weight: 600;" >Stats Heading Goes Here</h2>104 <div class="satisfaction-container">105 <div class="circular-chart" data-target="90">106 <div class="percentage">0%</div>107 </div>108 <div class="satisfaction-text">Noticed that this product has significantly improved their life</div>109 </div>110111 <div class="satisfaction-container">112 <div class="circular-chart" data-target="70">113 <div class="percentage">0%</div>114 </div>115 <div class="satisfaction-text">Noticed that this product has significantly improved their life</div>116 </div>117118 <div class="satisfaction-container">119 <div class="circular-chart" data-target="93">120 <div class="percentage">0%</div>121 </div>122 <div class="satisfaction-text">Noticed that this product has significantly improved their life</div>123 </div>124 </div>125126 <script>127 function animatePercentage(chart) {128 let percentageText = chart.querySelector('.percentage');129 let targetValue = parseInt(chart.getAttribute('data-target'));130 let currentPercentage = 0;131132 function updateChart() {133 if (currentPercentage <= targetValue) {134 chart.style.setProperty('--percentage', currentPercentage + '%');135 percentageText.innerText = currentPercentage + '%';136 currentPercentage++;137 requestAnimationFrame(updateChart);138 }139 }140 updateChart();141 }142143 function handleScroll() {144 const charts = document.querySelectorAll('.circular-chart');145 const windowHeight = window.innerHeight;146147 charts.forEach((chart) => {148 const chartPosition = chart.getBoundingClientRect().top;149 if (chartPosition < windowHeight - 100 && !chart.classList.contains('animated')) {150 animatePercentage(chart);151 chart.classList.add('animated');152 }153 });154 }155156 window.addEventListener('scroll', handleScroll);157 document.addEventListener('DOMContentLoaded', handleScroll);158 </script>159</body>160</html>
How to install Product Results on your Shopify theme
This snippet belongs in sections/main-product.liquid, directly under the Add to cart button, where it reinforces the purchase decision. Expect the whole job to take about 5–10 minutes.
- 1From your Shopify admin, open Online Store → Themes, click the … button on your live theme and choose Duplicate. Always work on a copy so you can roll back instantly.
- 2On the duplicated theme, click … → Edit code to open the theme code editor.
- 3Open sections/main-product.liquid in the file tree. If your theme uses different file names, search for the template that renders the area where you want the block to show up.
- 4Click Copy code on this page, then paste the snippet directly under the Add to cart button, where it reinforces the purchase decision.
- 5The snippet ships with its own scoped
<style>block, so you do not need to touchbase.cssortheme.css. If you prefer to keep CSS centralised, move the contents of the style tag into your theme stylesheet and delete the inline block. - 6Keep the
<script>tag at the end of the snippet. It only runs once the surrounding markup exists in the DOM, so moving it higher up the file can break the behaviour. - 7Click Save, then hit Preview and check the block on desktop, tablet and mobile widths.
- 8When you are happy with the result, publish the duplicated theme from Online Store → Themes → Actions → Publish.
How to customise it
Every value below lives inside the snippet, so you can adapt Product Results to your brand without touching the rest of the theme.
- Colours — the snippet uses
#1cbcc3,#4abf8f,#66bb6a,#ccc. Replace those values inside the style block with your brand palette, keeping at least a 4.5:1 contrast ratio between text and background so the block stays accessible. - Gradient — swap the
linear-gradient(...)declaration for a flat background colour if you want a more minimal, theme-native look. - Sizing — adjust the font-size values (18px, 15px, 16px) and the padding so the block carries the same visual weight as the elements around it.
- Corners —
border-radius: 50%controls the roundness. Set it to 0 for a sharper editorial look, or increase it for a softer, app-like feel. - Copy — rewrite the hard-coded text (for example “Cricket Stats Chart”) in your own brand voice, and translate it if you sell in more than one language.
- Responsive behaviour — the
@mediaquery defines the mobile breakpoint. Adjust the pixel value if your theme uses a different breakpoint scale.
Common mistakes to avoid
These are the issues merchants run into most often when installing a snippet like this one.
- Editing the live theme directly. Duplicate it first — a single unbalanced Liquid tag can take a storefront down mid-campaign.
- Pasting the code into the wrong file. Dropped into
layout/theme.liquidinstead ofsections/main-product.liquid, this block will render on every page of the store, including ones where it makes no sense. - Renaming the CSS classes in the markup but not in the style block, or vice versa. The class names have to match exactly or the styling silently disappears.
- Adding the snippet twice on the same page. The script targets its selector, so two copies can conflict or double-fire.
- Publishing without testing on a real phone. Most Shopify traffic is mobile, and layout problems almost always surface there first.
Performance notes
What this block costs you in load time, and how to keep that cost at zero.
- The CSS is inline and scoped to this block, so it adds no extra network request. At a few kilobytes it has no measurable effect on your Lighthouse score.
- The JavaScript is vanilla — no jQuery, no external library, no additional request. Keep it after the markup so it never blocks rendering.
- Run PageSpeed Insights before and after you add the block so you have a concrete number rather than a guess.
SEO & accessibility
How to add this block without damaging your on-page structure or your rich results.
- Nothing in this snippet should replace your page
<h1>. Keep product and page headings intact and use<h2>or<h3>for the block's own heading so the document outline stays clean. - If the block shows review or rating content, keep it consistent with the structured data your review app already outputs. Duplicating or contradicting rating markup can cost you the rich result entirely.
- The block does not create a new URL, so there is no canonical or indexing change to make. It improves on-page engagement signals rather than crawlability.
Product Results — questions merchants ask
Will this snippet work with my theme?
It is built with standard Liquid, HTML and CSS, so it works with Dawn and virtually every Online Store 2.0 theme, as well as most vintage themes. The only thing that changes between themes is the file you paste it into — if yours has no sections/main-product.liquid, look for the equivalent template that renders the same area.
Do I need an app to use it?
No. This is theme code you own outright: no monthly fee, no third-party script tag, and no app that can break your storefront the next time it updates.
How long does it take to add “Product Results” to a store?
Most merchants have it live in under fifteen minutes — duplicate the theme, paste the code, adjust the colours and copy, preview on mobile, publish.
The block appears but nothing happens. What is wrong?
That is almost always a script-order problem. Check that the script tag is still at the bottom of the snippet and that the markup was not pasted inside another script or a Liquid comment block. Open your browser console and look for an error naming the snippet's selector.
The styling looks broken after pasting. How do I fix it?
Confirm you copied the whole snippet including the closing style tag, then check whether one of your theme's own CSS rules is overriding it. If a theme rule wins, increase the specificity of the snippet's selector rather than scattering !important through the file.
Will it slow my store down?
Not meaningfully. It is inline markup with scoped CSS and at most a few lines of vanilla JavaScript — no external libraries, no extra HTTP request. Optimising your product images will always have a far bigger impact on load time.
Can I use it on a client store or a commercial project?
Yes. Every snippet in the MCO Hub library is free to copy, modify and ship on any store, including client work. Attribution is appreciated but not required.
Related snippets
Keep exploring
Guides
Tools
Deals & Discounts



