Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Re: JS script doesn't work in email order confirmation template

JS script doesn't work in email order confirmation template

jango81
Visitor
3 0 0

I have to edit order confirmation template and i want use some js code, but it seems like script doesn't want start.
here is small code example:

<!doctype html>
<html lang="fi">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width">
    <link rel="stylesheet" type="text/css" href="/assets/notifications/styles.css">
  </head>

  <body>
    <h1 class="delivery_date">HELLO</h1>
    <script>
      document.querySelector('.delivery_date').innerHTML = 'SOMETHING HERE';
    </script>
  </body>
</html>

 

 

 

 

jango81_0-1727272827182.png

 

Replies 2 (2)

juanidi
Excursionist
11 1 1

Could you share store url?

Brett_Helium
Shopify Partner
286 54 129

Hey @jango81

 

From what I understand, it is up to the email recipient's email client whether or not to support Javascript, and many email clients do not for security reasons.


It may be helpful for you to share some additional information about what you are trying to accomplish to receive more help with this. For example, Shopify's email templates do support Liquid code, so if you are trying to make some sort of conditional text or use variables, I would recommend doing this directly with Liquid instead of Javascript.

Brett | Helium
- Customer Fields ✪✪✪✪✪ (360+ reviews)
- Meteor Mega Menu ✪✪✪✪✪ (290+ reviews)
- Strike Automatic Discounts NEW!