Custom Liquid
Advanced
Theme retirement | Context is no longer available on the Shopify theme store. Theme support and updates for current users will end after May 18, 2024. Learn more here.
We do not support code customizations. This guide offers a basic reference for developers and advanced users familiar with HTML and Liquid. Always test code changes on an unpublished copy of your theme. For assistance, we recommend finding a professional developer through Shopify Experts ↗ or Task Husky ↗.
With the Custom Liquid setting, you can extend your theme by adding snippets of Liquid or HTML code as a block or section in the theme editor.
Custom Liquid provides a reliable and safer option compared to directly editing your theme code. It will help keep your theme copy eligible for updates and avoid conflicts with the original theme code.
This guide shows how to add a Custom Liquid section and provides an example for adding anchor links to sections.
Add Custom Liquid section
Follow the steps below to add Custom Liquid section and test your custom code.
Shopify | Liquid is the template language used by Shopify. See their Liquid reference guide to learn more. Also check out Shopify's Liquid code examples.
Add anchor links to sections
If you want to link to a specific section on a page, you can use a Custom Liquid section with some HTML as a workaround.
This method involves adding a Custom Liquid section directly above the section you want to link to. Then you can add an empty span
with an id
property, and use that id
as an anchor link.
Since the Custom Liquid span will be empty, it will not affect the page layout but the link will scroll to the top of the section you want to show.
Shopify | Shopify dynamically generates ids for sections but these ids are not stable. Adding custom ids is a workaround for this platform limitation.
Related links
Last updated