Skip to content

Instantly share code, notes, and snippets.

@webtoffee-git
Last active June 4, 2021 08:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webtoffee-git/0937e324685f30180c30ba3ee107ac02 to your computer and use it in GitHub Desktop.
Save webtoffee-git/0937e324685f30180c30ba3ee107ac02 to your computer and use it in GitHub Desktop.
Print orders in chronological order in Picklist-PDF Invoice/Packing Slip for WooCommerce
<?php
add_filter('wf_pklist_alter_package_grouped_order_items','wt_pklist_sort_items_asc_in_picklist',10,5);
function wt_pklist_sort_items_asc_in_picklist($item_arr, $grouping_config, $order_package, $template_type, $order)
{
if($template_type=='picklist')
{
$id_arr=array();
foreach ($item_arr as $id => $item)
{
$id_arr[]=$id;
}
array_multisort($id_arr, SORT_DESC, $item_arr);
}
return $item_arr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment