What variable (or how do we get) the Delivery Date and the customer comment onto the outgoing customer order confirmation email in Magento 2?

  • whats the field name for deliverydate and customer comment? – Rakesh Jesadiya Sep 1 '17 at 5:00

This may be helpful /From where you send a Email [custom email Function]

public function yourCustomMailSendMethod($emailTemplateVariables,$senderInfo,$receiverInfo)
    /* Here we prepare data for our email  */

/* Receiver Detail  */
$receiverInfo = [
    'name' => 'Reciver Name',
    'email' => 'receiver@address.com'

/* Sender Detail  */
$senderInfo = [
    'name' => 'Sender Name',
    'email' => 'sender@address.com',

/* Assign values for your template variables  */
$emailTemplateVariables = array();
$emailTempVariables['customer_comment '] = $comment ;
$emailTempVariables['delivery_date'] = $Delivery;
    $this->temp_id = $this->getTemplateId(self::XML_PATH_EMAIL_TEMPLATE_FIELD);
    $transport = $this->_transportBuilder->getTransport();

Here we will use “your_email_template.html” name for email template

{{template config_path="design/email/header_template"}} 
<!-- pathe of template header-->

<!-- here customer_comment ,Delivery_Date are variables in which we
                                 asssign values when we use this template  for send mail-->

<!-- you can Modify content of template according to your requirement-->

    <tr class="email-information">
            <table class="order-details">
                    <td class="address-details">
                        <h3>{{trans "Customer Comment"}}</h3>
                        <p>{{var customer_comment}}</p>
                    <td class="address-details">
                        <h3>{{trans "Delivery Date"}}</h3>
                        <p>{{var delivery_date}}</p>
    </tr> </table>   {{template config_path="design/email/footer_template"}} <!--footer of template-->
| improve this answer | |

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.