cancel
Showing results for 
Search instead for 
Did you mean: 

how to admin panel created email template with order details

SOLVED

how to admin panel created email template with order details

Hi all,

i have created email template in admin panel i want to send this template with order details programmatically. Please help me on this.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: how to admin panel created email template with order details

@tippanna_pawar 

 

This was just a piece of code explaining how to set email template, as I said, follow this tutorial :

https://meetanshi.com/blog/send-custom-emails-programmatically-in-magento-2/

 

and you can set your order details in array 

$templateVars = [
                'name' => '[FETCH CUSTOMER NAME FROM BILLING ADDRESS]',
                'total' => '[FETCH TOTALS FROM BILLING ADDRESS]'
            ];

and you can pass those variables which can be used in template like below :

{{var name}}

{{var total}}

Let us know if it works for you !

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

View solution in original post

4 REPLIES 4

Re: how to admin panel created email template with order details

Hi @tippanna_pawar 

 

Kindly refer below link :


https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/templates/template-email.html 

 

It may help you!

Thank you.

Problem solved? Click Accept as Solution!

Re: how to admin panel created email template with order details

Hello @tippanna_pawar 

 

Refer to this blog it shows how to send email programatically by using admin email email template :

https://meetanshi.com/blog/send-custom-emails-programmatically-in-magento-2/

 

PS : In any email sending code, just pass the email-template-identifier like below :

$this->transportBuilder->setTemplateIdentifier($templateId, $storeScope)

Hope it helps !

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

Re: how to admin panel created email template with order details

but i tried with the below code it is sending empty template without order details..? Can help me in sending order details to it.

Re: how to admin panel created email template with order details

@tippanna_pawar 

 

This was just a piece of code explaining how to set email template, as I said, follow this tutorial :

https://meetanshi.com/blog/send-custom-emails-programmatically-in-magento-2/

 

and you can set your order details in array 

$templateVars = [
                'name' => '[FETCH CUSTOMER NAME FROM BILLING ADDRESS]',
                'total' => '[FETCH TOTALS FROM BILLING ADDRESS]'
            ];

and you can pass those variables which can be used in template like below :

{{var name}}

{{var total}}

Let us know if it works for you !

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy