Custom HTML
The custom HTML block accepts raw HTML and Liquid markup through Shopify’s liquid field type, making it a flexible escape hatch for one-off content that does not fit neatly into other blocks. Shopify automatically sanitizes the input to strip out script tags and event handlers, so it is safe for use by store editors while still supporting Liquid objects, filters, and tags.
Settings
Section titled “Settings”| Setting | What it does |
|---|---|
| Custom HTML/Liquid | The freeform code to render. Supports HTML elements, Liquid tags, and Liquid objects. Script tags and inline JavaScript are stripped by Shopify. |
| Custom ID | An optional ID attribute added to a wrapper div around the content. Useful for anchor links or targeted CSS. |
Used in
Section titled “Used in”Any section that accepts theme blocks.
- This block is best for small, targeted insertions like embed codes, custom badges, or Liquid-driven dynamic content. For large layout changes, a dedicated block or section is usually a better fit.
- Shopify’s sanitization removes script tags and JavaScript event handlers automatically. If you need client-side interactivity, use Alpine.js directives in the markup instead.
- The custom ID field only adds a wrapper div when it has a value. When left blank, the content renders without any extra wrapper element.