1

I am overriding Sales Order Email to changing the position of Billing Info and Shipping Info, But it is not working.

app/design/frontend/[Vendor_Name]/[Theme_Name]/locale/en_US/template/email/sales/order_new.html

<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<!--@subject {{trans "Your %store_name order confirmation" store_name=$store.getFrontendName()}} @-->
<!--@vars {
"var formattedBillingAddress|raw":"Billing Address",
"var order.getEmailCustomerNote()":"Email Order Note",
"var order.increment_id":"Order Id",
"layout handle=\"sales_email_order_items\" order=$order area=\"frontend\"":"Order Items Grid",
"var payment_html|raw":"Payment Details",
"var formattedShippingAddress|raw":"Shipping Address",
"var order.getShippingDescription()":"Shipping Description",
"var shipping_msg":"Shipping message"
} @-->

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

<table>
    <tr class="email-intro">
        <td>
            <p class="greeting">{{trans "%customer_name," customer_name=$order.getCustomerName()}}</p>
            <p>
                {{trans "Thank you for your order from %store_name." store_name=$store.getFrontendName()}}
                {{trans "Once your package ships we will send you a tracking number."}}
                {{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
            </p>
            <p>
                {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}.
                {{depend store_hours}}
                    {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}}
                {{/depend}}
            </p>
        </td>
    </tr>
    <tr class="email-summary">
        <td>
            <h1>{{trans 'Your Order <span class="no-link">#%increment_id</span>' increment_id=$order.increment_id |raw}}</h1>
            <p>{{trans 'Placed on <span class="no-link">%created_at</span>' created_at=$order.getCreatedAtFormatted(2) |raw}}</p>
        </td>
    </tr>
    <tr class="email-information">
        <td>
            {{depend order.getEmailCustomerNote()}}
            <table class="message-info">
                <tr>
                    <td>
                        {{var order.getEmailCustomerNote()|escape|nl2br}}
                    </td>
                </tr>
            </table>
            {{/depend}}
            <table class="order-details">
                 <tr>
                    <td class="address-details">
                        <h3 style="font-weight: bold;">{{trans "Shipping Info"}}</h3>
                        <p>{{var formattedShippingAddress|raw}}</p>
                    </td>
                    {{depend order.getIsNotVirtual()}}
                    <td class="address-details">
                        <h3 style="font-weight: bold;">{{trans "Billing Info"}}</h3>
                        <p>{{var formattedBillingAddress|raw}}</p>
                    </td>
                    {{/depend}}
                </tr>
                <tr>
                    <td class="method-info">
                        <h3>{{trans "Payment Method"}}</h3>
                        {{var payment_html|raw}}
                    </td>
                    {{depend order.getIsNotVirtual()}}
                    <td class="method-info">
                        <h3>{{trans "Shipping Method"}}</h3>
                        <p>{{var order.getShippingDescription()}}</p>
                        {{if shipping_msg}}
                        <p>{{var shipping_msg}}</p>
                        {{/if}}
                    </td>
                    {{/depend}}
                </tr>
            </table>
            {{layout handle="sales_email_order_items" order=$order area="frontend"}}
        </td>
    </tr>
</table>

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

But it is not changed the position, see below pic.

enter image description here

Any help? For changing the position of Billing Info and Shipping Info.

  • Just updated my answer. please check and let me know – Rakesh Jesadiya Jan 19 '17 at 9:27
3

Your override file path is incorrect.

You have to just override order_new.html file at below location.

app/design/frontend/[Vendor_Name]/[Theme_Name]/Magento_Sales/email/order_new.html

Clear Cache.

  • I moved the file location to your given path. still not working. – Bojjaiah Jan 19 '17 at 9:04
  • please run php bin/magento setup:static-content:deploy command and remove var folder – Rakesh Jesadiya Jan 19 '17 at 9:04
  • Sorry i have add sales folder before order_new.html file i have just removed sales folder and you have to follow updated answer path and after changes your issue resolved. You have to remove sales folder. – Rakesh Jesadiya Jan 19 '17 at 9:26
  • Yes, I saw that it's a wrong path. Now Updated and working fine. Thank You. – Bojjaiah Jan 19 '17 at 9:55
  • @RakeshJesadiya store_name value not getting in shipment_new.html magento.stackexchange.com/q/208776/50730 – Kumar Shanmugam Jan 9 '18 at 22:50
0

Best way to do the thing from admin.

First goto Admin>Marketing>Email Templates

Then created new template by Select Default Template and click on Load template

enter image description here Then on Template Content your need to change on your template content

Then click on Save Template button in order save this template

After that you need assign that template at Store>Configuration>Sales>Sales Email at New Order Confirmation Template

enter image description here

require to do same thing for New Order Confirmation Template for Guess

  • I have did same thing for Reset Password, But my custom email template not called. Can you please tell me what I missing? – Ravi Soni Nov 12 '17 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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