'How to use WC_Order_Query class with custom order status
There is a new order status I created: packed.
I want to get orders with order status "packed". This order status must have been created at least 2 days ago. However, I have a problem with time. date_modified is not working according to local time. Has anyone encountered this problem and has a solution?
$two_days_ago = date(strtotime('-2 day'), current_time('timestamp'));
$current_time = current_time('timestamp');
$args = array(
'limit' => -1,
'return' => 'ids',
'date_modified ' => $two_days_ago_tomorrow.'...'.current_time('timestamp'),
'status' => 'a-packed'
);
$query = new WC_Order_Query( $args );
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
