It is possible to sort Email order confirmation by sku in both customer email notification and Admin email notification

magento.stackexchange https://magento.stackexchange.com/questions/318056

문제

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)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top