I want to get count of total number of items purchased on my wordpress site and display this number somewhere. I am using woocomerce 1.6.6 plugin and i want some shortcode or function or db query to do this.
Please help.
Leave a Reply
You must be logged in to post a comment.
I realise this question is well over a year old, but for anyone who stumbles upon it, like I just did, here’s how to get the total number of sales of all products in Woocommerce. I needed this for a project since for each product purchased, one is to be donated to people in need. Hence, I wanted to show the total number of donations (= sales).
Each product has a total_sales meta field, so all we need to do is query the database for the sum of all products’ total_sales:
Based on this answer.