I am trying to get the trash order list from WooCommerce Shop Order. Previously i tried with Order Status to Publish it return properly for my needs. Now in the WooCommerce Version 2.2+ they added the Post Status as wc-completed something. In this case i cannot get the trash post.
I tried as something like
function gettrashedorderlist() {
$args = array('post_type'=>'shop_order','posts_per_page'=>'-1','post_status'=>array('trash'));
foreach(get_posts($args) as $eachorder) {
// Something goes here
}
}
With latest version i unable to get the trashed order list. I also tried as something like
function gettrashedorderlist() {
$args = array('post_type'=>'shop_order','posts_per_page'=>'-1','post_status'=>array('wc-completed'));
foreach(get_posts($args) as $eachorder) {
// Something goes here
}
}
It is working but in this case i get a serious trouble because it displays all the orders including trashed order list. Not sure if something i made wrong or i understood wrong.
Ideally when i trying the post status as wc-completed instead of listing all those order including that i trashed, it should show excluding the trashed order.
Is that any way to achieve this ?
Thanks.