1

I have upgraded my magento version from 2.4.2 to 2.4.3-p3. After upgrade Shipping Address is missing from Order Confirmation Email Template.

Order Confirmation mail before Upgrade

enter image description here

Order confirmation email after upgrade

enter image description here

We can see after upgrade Ship To option is missing from the email template. I have compared the email templates before and after upgrade. The content is same. Only 1 difference is there and that is how Magento fetch the Order Id in the newer version.

Content of email template before Upgrade

{{template config_path="design/email/header_template"}}


<table cellpadding="0" cellspacing="0" border="0" class="email-box">
    <tr>
        <td>
            <table cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td class="email-heading">
                        <h1>Thank you for your order from {{var store.frontend_name}}.</h1>
                        <p>Once your package ships we will send an email with a link to track your order. Your order summary is below. Thank you again for your business.</p>
                    </td>
                    <td class="store-info">
                        <h4>Order Questions?</h4>
                        <p>
                            {{depend store_phone}}
                            <b>Call Us:</b>
                            <a href="tel:{{var phone}}">{{var store_phone}}</a><br>
                            {{/depend}}
                            {{depend store_hours}}
                            <span class="no-link">{{var store_hours}}</span><br>
                            {{/depend}}
                            {{depend store_email}}
                            <b>Email:</b> <a href="mailto:{{var store_email}}">{{var store_email}}</a>
                            {{/depend}}<br>
              
                  </p>
                </td>
            </tr>
        </table>
    </td>
</tr>
<tr>
    <td class="order-details">
        <h3>Your order <span class="no-link">#{{var order.increment_id}}</span></h3>
        <p>Placed on {{var created_at_formatted}}</p>
    </td>
</tr>
<tr class="order-information test">
    <td>

        {{if order_data.email_customer_note()}}
        <table cellspacing="0" cellpadding="0" class="message-container">
            <tr>
                <td>{{var order_data.email_customer_note|escape|nl2br}}</td>
            </tr>
        </table>
        {{/if}}
{{layout handle="sales_email_order_items" order=$order area="frontend"}}

        <table cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td class="address-details">
                    <h6>Bill to:</h6>
                    <p><span class="no-link">{{var formattedBillingAddress|raw}}</span></p>
                </td>
                {{depend order.getIsNotVirtual()}}
                <td class="address-details">
                    <h6>Ship to:</h6>
                    <p><span class="no-link">{{var formattedShippingAddress|raw}}</span></p>
                </td>
                {{/depend}}
            </tr>
            <tr>
               {{depend order_data.is_not_virtual}}
                <td class="method-info">
                    <h6>Shipping method:</h6>
                    <p>{{var order.shipping_description}}</p>
                </td>
                {{/depend}}
                <td class="method-info">
                    <h6>Payment method:</h6>
                   {{var payment_html|raw}}
                </td>
             </tr>
          </table>
        </td>
      </tr>
    </table>
  {{template config_path="design/email/footer_template"}}

Content of email template after upgrade

{{template config_path="design/email/header_template"}}


<table cellpadding="0" cellspacing="0" border="0" class="email-box">
<tr>
    <td>
        <table cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td class="email-heading">
                    <h1>Thank you for your order from {{var store.frontend_name}}.</h1>
                    <p>Once your package ships we will send an email with a link to track your order. Your order summary is below. Thank you again for your business.</p>
                </td>
                <td class="store-info">
                    <h4>Order Questions?</h4>
                    <p>
                        {{depend store_phone}}
                        <b>Call Us:</b>
                        <a href="tel:{{var phone}}">{{var store_phone}}</a><br>
                        {{/depend}}
                        {{depend store_hours}}
                        <span class="no-link">{{var store_hours}}</span><br>
                        {{/depend}}
                        {{depend store_email}}
                        <b>Email:</b> <a href="mailto:{{var store_email}}">{{var store_email}}</a>
                        {{/depend}}<br>
              
                  </p>
                </td>
            </tr>
        </table>
    </td>
</tr>
<tr>
    <td class="order-details">
        <h3>Your order <span class="no-link">#{{var order.increment_id}}</span></h3>
        <p>Placed on {{var created_at_formatted}}</p>
    </td>
</tr>
<tr class="order-information test">
    <td>

        {{if order_data.email_customer_note()}}
        <table cellspacing="0" cellpadding="0" class="message-container">
            <tr>
                <td>{{var order_data.email_customer_note|escape|nl2br}}</td>
            </tr>
        </table>
        {{/if}}
{{layout handle="sales_email_order_items" order_id=$order_id area="frontend"}}

        <table cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td class="address-details">
                    <h6>Bill to:</h6>
                    <p><span class="no-link">{{var formattedBillingAddress|raw}}</span></p>
                </td>
                {{depend order.getIsNotVirtual()}}
                <td class="address-details">
                    <h6>Ship to:</h6>
                    <p><span class="no-link">{{var formattedShippingAddress|raw}}</span></p>
                </td>
                {{/depend}}
            </tr>
            <tr>
               {{depend order_data.is_not_virtual}}
                <td class="method-info">
                    <h6>Shipping method:</h6>
                    <p>{{var order.shipping_description}}</p>
                </td>
                {{/depend}}
                <td class="method-info">
                    <h6>Payment method:</h6>
                   {{var payment_html|raw}}
                </td>
             </tr>
           </table>
        </td>
     </tr>
   </table>

{{template config_path="design/email/footer_template"}}

I googled this issue but did not find any solution. And also we can see Ship to address is called in email template but it is blank when the mail is received. Could some one guide me with this.

1 Answer 1

2

Magento made changes to the way email template variable resolving happens.

As of Adobe Commerce and Magento Open Source 2.3.4, custom email templates are only allowed to use scalar values for variable data. Direct calls to methods are no longer allowed. To be more specific, methods can no longer be called from variables from either the var directive or when used as parameters. For example {{var order.getEmailCustomerNote()}} or {{something myVar=$obj.method()}} will fail to resolve.

So looks to me like you need to replace this:

{{depend order.getIsNotVirtual()}}

With this instead:

{{depend order_data.is_not_virtual}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.