WooCommerce – How to calculate sum of all the sales ever done on the store? Posted on Updated June 2, 2020June 7, 2020 by Pramod Jodhani PHP <?php global $wpdb; echo $wpdb->get_var( "SELECT sum(total_sales) FROM {$wpdb->prefix}wc_order_stats" ); ?> « How to set minimum and maximum purchasable quantity for a WooCommerce product without any plugin. WooCommerce – How to offer a free product with the purchase of certain products »