Magento Asked by M2 Dev on October 1, 2021
I am on the m2 site. In order confirmation email I am getting SKU. But I need that SKU sort by ASC. Could someone assist me with this? Thanks in advance.
I have overridden the below file in my theme to get SKU in order confirmation email.
vendor/magento/module-sales/view/frontend/templates/email/items.phtml
Override the file vendor/magento/module-sales/view/frontend/templates/email/items.phtml in your theme add below code.
$_items = $_order->getAllItems(); $sortSKU = array(); foreach ($_items as $item) { $sortSKU[$item->getSku()] = $item; } ksort($sortSKU);
And Insted of
foreach ($_items as $_item) use
foreach ($sortSKU as $_item)
Correct answer by M2 Dev on October 1, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP