fetch orders of woocomerce from wordpress database by date

<?php

require_once('wp-config.php');

global $wpdb;

$date_from = $_GET['datefrom'];
$date_to = current_time('mysql');

$result = $wpdb->get_results( "SELECT * FROM  `wp_posts` 
            WHERE post_type = 'product'
   AND post_status = 'publish'
   AND post_modified BETWEEN '".$date_from."' AND '".$date_to."'
   ");

echo "<pre>";

if(is_array($result)){
 $data= json_encode($result);
 echo $data;
 echo "<br>";
}

?>
It uses wedb class of wordpress to query the database.

Popular posts from this blog

What are sales territory in Netsuite?

How to get and set a sublist in netsuite suitlet suitescript 2.0