Copy-paste a Liquid snippet for utility - A floating button that fades in after the shopper scrolls, then smoothly returns them to the top of the page.
1Back up your theme (Online Store > Themes > Actions > Duplicate) before changing any code.
2Open Online Store > Themes > Edit code and create a new file under Snippets named back-to-top.liquid.
3Paste the complete file - markup, styles and JavaScript are already inside the single file, nothing else to install.
4Call the snippet from the template or section where it should appear using the render tag shown in the Usage tab.
5Preview the product, collection or cart page and test on mobile before publishing.
back-to-top.liquid
1{%- comment -%}2 Render once near the end of theme.liquid (or a layout file) so it works on3 every page. Pure CSS + a tiny scroll listener.4{%- endcomment -%}5<buttontype="button"class="gpl-totop gpl-totop--right" data-gpl-totop aria-label="Back to top" hidden>6<svgviewBox="0 0 24 24"fill="none"stroke="currentColor"stroke-width="2"stroke-linecap="round"stroke-linejoin="round"aria-hidden="true"><pathd="M12 19V5"/><pathd="m5 12 7-7 7 7"/></svg>7</button>