I'm trying to create an email that's sent to me after I want the total amount of the purchase to be displayed in 2 digits . How can I display like this... Display right : $ 79.90 . Current display is wrong : $ 79,9000 .

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

    <tr class="email-intro">
                         <p class="greeting">{{trans "%name," name=$order_data.customer_name}}</p>
                        <p>Thank you for your order with Designer Wholesale Eyewear</p>
                        <p>Please make full payment of : £ {{trans "%total" total=$order.getGrandTotal() }}
                        <p>Account Name: GNST Service Ltd</p>
                        <p>Bank Name: Natwest </p>
                        <p>Account Number: 00000000000</p>
                        <p>Sort Code: 50-21-01</p>
                        <p>As per our terms & conditions you must make a payment within 24 hours of placing the order, if payment is not received orders are automatically cancelled</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}}
    <tr class="email-information">
            {{depend comment}}
            <table class="message-info">
                        {{var comment|escape|nl2br}}

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

Image :: https://i.sstatic.net/Z2crj.png

image fail

thanks for everything

1 Answer 1


You should use the below way to get formatted price of Order Total.

Step 1:- Please create events.xml file under path PackageName/Module/etc/

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="email_order_set_template_vars_before">
      <observer name="add_Custom_variable_to_Order" instance="PackageName\Module\Observer\OrderEmail" />

Step 2:- Please create file OrderEmail.php under path PackageName/Module/Observer/


namespace PackageName\Module\Observer;

use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;

class OrderEmail implements ObserverInterface
    protected $pricingHelper;

    public function __construct(
        \Magento\Framework\Pricing\Helper\Data $pricingHelper
        $this->pricingHelper = $pricingHelper;

     * @param Observer $observer
    public function execute(Observer $observer)
        $transport = $observer->getTransport();
        $order     = &$transport['order'];
        if ($order->getGrandTotal()) {
            $formattedTotal = $this->pricingHelper->currency($order->getGrandTotal(),true,false);
            $transport['ordertotal'] = $formattedTotal;

Step 3:- Add below line in your email template

<p>Please make full payment of : {{var ordertotal}}</p>

Output will be like - https://prnt.sc/1qxxap2

Please use the above way to fulfil your requirement.

  • 1
    It works. Thank you! Sep 1, 2021 at 17:48

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.