PressTigers

How to Get WooCommerce Current Month Sales Summary in the Dashboard Widget

WordPress provides a very pleasant feature of Dashboard Widget to keep the user updated with their activities. In this article, you will learn how to make a Widget that consists of WooCommerce current month archive of complete orders.

You need to add the following code snippets in your Theme’s functions.php file. As an outcome, it will generate the sales summary of current month on your Dashboard.

After creating the Widget, add ptmp_montly_sales_dashboard_widget() function. As a result, this function will list the sales history of each product sold along with their line total.

For the CSS of Dashboard Widget, you need to create a CSS file to include it in the admin area using the following code:

Place the CSS in admin-style.css file for a widget look and feel using the following code:

Upon the successful execution of the code mentioned above, you will be able to see the following final output on your Dashboard as shown in figure:

how-to-get-woocommerce-current-month-sales-summary-in-the-dashboard-widget-1

In our next article, you will learn to get the sales summary for custom monthly archives.

Written By: Abdullah Ramzan

User Comments

5 thoughts on “How to Get WooCommerce Current Month Sales Summary in the Dashboard Widget

    Zaheer Abbas says:

    Awesome work. But i am unable to edit products from above created widget.

    Antonio says:

    Hi, guys!
    ¿How would I add a row with the total of this sales (cimplete orders)?
    Regards anyway!
    Antonio

    feli_x says:

    Thanks a lot! This helped me to find out how the get_order_report_data method works for a plugin I am just developing.
    Regards
    feli_x

Leave a Reply

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

    Get in Touch