Using Theme Settings in Email Notifications

New Member
1 0 0

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!

0 Likes
Highlighted
Shopify Partner
1647 206 325

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}}
Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
0 Likes