Woocommerce reports in front-end

I’m trying to create a custom report dashboard in the front-end with a nice chart with the daily sales, but I fail to retrieve the reports

what I tried which its giving me You have an error in your SQL syntax error is

function full_month_report(){
  include_once(WC()->plugin_path(). '/includes/admin/reports/class-wc-report-sales-by-date.php' );
  $sales_by_date = new WC_Report_Sales_By_Date();
  $d = date_i18n('t');
  $d = (int)$d;
  $month_report = array();
  for($i = 1; $i <= $d; $i++){
    $i = sprintf("%02d", $i);
    $date = strtotime(date( 'Ym'.$i ));
    $sales_by_date->start_date = $date;
    $sales_by_date->end_date = $date;
    $day_report = $sales_by_date->get_report_data();
    array_push($day_report, $month_report);
  return $month_report;

What’s the best way to get an object/array with the reports data in front-end?

Go to Source
Author: Razvan Cuceu