PHP Woocommerce Get All Today’s Orders

You will get all completed orders of today in wordpress / woocommerce store.

    $today = date('Y-m-d');
    $args = array(
        'post_type' => 'shop_order',
        'post_status' => 'wc-completed',
        'posts_per_page' => -1,
        'date_query' => array(
            array(
                'column' => 'post_date',
                'after' => $today,
                'before' => $today,
                'inclusive' => true,
            ),
        ),
    );
    $orders = get_posts($args);

Leave a Reply

Your email address will not be published.