Skip to content
Advertisement

Sorting order items by SKU in Woocommerce

I am trying to order the products by sku within an order in an email in Woocommerce.

I have not had any luck with the following code.

Some help? Thanks since now!

JavaScript

Sample sort result:

  • INFSTRAW I
  • NFMUFFIN
  • INFFLORES
  • INFTAFLOR
  • INFTAPINK
  • CTEPINK4
  • CTECAKE4
  • INFCHOCO
  • UCUBTOMA

Advertisement

Answer

Updated On July 2020

Here is the way to do it:

JavaScript

Code goes in function.php file of your active child theme (or active theme). Tested and works.

This will sort items by sku order ASC on backend and frontend orders and in email notifications


Also sorting items once the order is placed before data is saved to the database, could be a better way to do it.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement