Viewing 1 replies (of 1 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hello Kelly,
    That is certainly possible. ??
    With the following filter you can sort your items by SKU:

    
    //Sort items by SKU
    add_filter( 'wpo_wcpdf_order_items_data', 'wpo_wcpdf_sort_items_by_sku', 10, 2 );
    function wpo_wcpdf_sort_items_by_sku ( $items, $order ) {
    	usort($items, 'wpo_wcpdf_sort_by_sku');
    	return $items;
    }
    
    function wpo_wcpdf_sort_by_sku($a, $b) {
    	if ($a['sku']==$b['sku']) return 0;
    	return ($a['sku']<$b['sku'])?-1:1;
    }
    

    If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters

    Have a great day & let us know if you need more help with this!

    Ewout

Viewing 1 replies (of 1 total)
  • The topic ‘Sku Order’ is closed to new replies.