we have amended our Magento 2.1 to use and store prices with 4 decimal places. But then used some JS to trim/round-up on the frontend to 2 decimal places.
However, on the email templates, the price is displaying with 4 decimal places e.g. £15.99000
Can I override the default email template to format the number to 2 decimal places (since the email doesn't allow JS)
I am currently looking at
vendor/magento/module-sales/view/frontend/templates/email/items/order/default.phtml
And the price is currently being called like this...
<td class="item-price">
<?= /* @escapeNotVerified */ $block->getItemPrice($_item); ?>
</td>
I tried changing the above to this instead...
<?php echo number_format($_item->getItemPrice(), 2); ?>
But that just seems to zero out the price, however it does read with 2 decimal places. So instead of it being £15.99 I just get £0.00
Where is my replacement code going wrong or am I even in the right place?
Thanks