To add a Custom liquid block in Shopify's Horizon theme, open Online Store, then Themes, and click Customize. Switch the template picker at the top to your product template, find the product information section in the left sidebar, hover just under the Buy buttons block until a plus appears, click it and choose Custom liquid. Paste your code into the block's text box and click Save. The block now appears under the Add to cart button on every product that uses that template.
That is the short version. The rest of this guide covers what to check before you start, what you can paste, and the usual reasons a block does not appear.
Before you start
A few things save time later:
- Work on a copy. In Themes, use the three-dot menu on your live theme and choose Duplicate. Make the change on the copy, preview it, then publish. If you edit the live theme directly, shoppers see every step.
- Know which template your products use. Most stores use the default product template. Some have extra templates for certain products, and a block added to one template does not appear on the others.
- Check your theme version. Horizon and the themes built on it are updated over time, and block names and the exact position of buttons in the editor can differ between versions and between Horizon-family themes. If a label in this guide does not match your screen, look for the nearest equivalent.
Older themes also have a Custom liquid block, but they may list it under a different section, or only allow it as a separate section rather than inside the product information.
Step by step: add the block under Buy buttons
- In your Shopify admin, open Online Store, then Themes.
- On the theme you want to edit, click Customize.
- In the drop-down at the top of the editor, which usually reads Home page, choose Products, then the template your products use, usually Default product.
- In the left sidebar, open the product section that holds the title, price and buttons. In Horizon its blocks are listed as a nested group, with Buy buttons among them.
- Hover your pointer just under Buy buttons. A thin line with a plus appears between blocks. Click the plus. If you do not see it, use the Add block link at the bottom of that group and then drag the new block under Buy buttons.
- In the block picker, search for Custom liquid and select it.
- In the block's settings on the right, paste your code into the Liquid box.
- Check the preview on desktop, then switch to the mobile preview with the icon at the top of the editor.
- Click Save.
The order of blocks in the sidebar is the order on the page. Drag the Custom liquid block up or down if you want it above the buttons or further down.
What you can paste
The box accepts HTML and Liquid, Shopify's template language. Some common uses:
| You want | Paste something like |
|---|---|
| A short line of text | <p>Ships within 2 business days. Free returns for 30 days.</p> |
| Text that uses product data | <p>{{ product.title }} is made to order.</p> |
| A widget from an app or service | The single line the service gives you, such as a <div> with its own attributes |
Keep each block to one job. If you need a delivery note and a widget, two blocks are easier to move and remove than one block with both.
A note on scripts: many widgets need two parts, a script that loads once for the whole site and a small line that marks where the widget shows. The script usually belongs in your theme's layout file, layout/theme.liquid, just before the closing </body> tag (Edit code in the theme menu). The Custom liquid block then only needs the small line. Putting the full script into the block on every product works on some setups but loads it in a less predictable place.