Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Hello!
For one of our clients, we are looking to customize the default email templates and have been trying to add some data from our settings_data.json file of our theme. This is easy using the Liquid syntax within the theme files, but we can't figure out how to access this data from the email templates.
If you need more information, they use a variable called "header_message" to display a message at the top of each page of the site. They would like this on the Order Confirmation emails as it indicates when orders will be available each week.
I spoke to customer support and they ask the forums. Appreciate the help!
Unfortunately, you cannot use data from theme settings, but you can work it around using theme's locale files, which are available in notification temapltes. Under Shopify Code editor, open locales/en.default.json of the currently live theme (important), add a new key and make sure the key ends with _html, like this:
{ "general": { "header_html": "<div>Our fancy header</div>" } ....
Then, in your notification template you can render its content using:
{{'general.header_html' | t}}
Brilliant! Thank you from 3 years into the future!