Custom code
Most changes don't need code: try the theme editor, sections and blocks first. When you do need code, read this page before you start.
#Before you edit any code
- Duplicate the theme. In Online Store > Themes, select ... > Duplicate next to Balm, and make your changes in the copy. Publish the copy only when it works.
- Keep a list of your changes. Theme updates don't carry code changes over (see How do I update Balm?), so you'll need the list to make them again.
- Consider hiring a Shopify Partner. For anything beyond a small snippet, a developer from the Shopify Partner directory can make the change safely.
#What support covers
| Covered | Not covered |
|---|---|
| Questions about Balm's settings, sections, blocks and ritual data | Writing, changing or debugging custom code |
| Bugs in Balm's own code | Bugs caused by code you or a developer added |
| Where to paste an app's snippet (Custom Liquid section or block) | Setting up or fixing third-party apps |
The examples on this page are not supported: they're here to save you time, and you use them at your own risk, in a duplicated theme.
If you report a problem with a customized theme, we may ask you to check whether it also happens on a fresh copy of Balm from your theme library. If it doesn't, the cause is in the custom code.
#Add code without editing theme files
The Custom Liquid section (any page) and Custom Liquid block (in sections that take theme blocks) run Liquid, HTML and app snippets. This is the safest place for code, because it's stored in your theme settings and carries over when you update Balm.
#Examples
#Show a note on products with a tag
In the product page's Product information section, add a Custom Liquid block with:
{% if product.tags contains 'vegan' %}
<p>Vegan formula</p>
{% endif %}
#Read your own metafield
To show a metafield that has no Balm setting, add a Custom Liquid block with your namespace and key:
{{ product.metafields.custom.origin.value }}
For text settings, connecting a dynamic source in the theme editor does the same thing without code (Dynamic sources).
#Things to leave as they are
These parts of Balm's code hold the ritual together. Changing them can break the header, cards, Ritual view or cart all at once:
snippets/ritual-data.liquid, which reads each product's ritual data,- the tag prefixes and
balm.*metafield keys, and - the collection template named ritual.
These pages describe Balm 1.0.0 and are updated with every release. See the release notes for what changed.