PressTigers

Getting WooCommerce Monthly Sales Archive in Dashboard Widget

In the previous article, getting WooCommerce current month sales summary in the Dashboard Widget was explained. Picking up from where we left off, we’ll begin this tutorial by developing a feature of order history in which every one of the orders from the earliest starting point till the present month will be listed.

You need to add the following code snippets in your Theme’s functions.php file. As an outcome, it will generate monthly sales archive on your Dashboard. You need to make sure to create JS (admin-script.js) and CSS (admin-style.css) files to include the CSS and JS in the admin area according to your Theme or plugin structure.

New addition in the widget is the “dropdown” in which months are displayed on the basis of orders. Additionally, you need to use a functional approach so that the code can easily be understood and reused.

This code has been provided to enqueue the JS and CSS files in the admin area accordingly. Now create a JS file as mentioned earlier and add the following code in it:

The CSS code has been provided in the previous article, so here you just need to add the following CSS rules in that previous CSS file:

Upon the successful execution of the code mentioned above, you will be able to see the following final output of monthly sales archive on your Dashboard:

getting-woocommerce-monthly-sales-archive-in-dashboard-widget-1

Written By: Abdullah Ramzan

User Comments

4 thoughts on “Getting WooCommerce Monthly Sales Archive in Dashboard Widget

    Ex says:

    Thanks but How can I export this list in csv ? You can Add a button there to export.

    mike says:

    how can we add total weight sold aswell ?

Leave a Reply

Your email address will not be published. Required fields are marked *

    Get in Touch