Welcome back to our WooCommerce Weekly appointment – here comes a series of WooCommerce tutorials put together by yours truly so that you can learn something new.
New WooCommerce Tips
WooCommerce: Get Total Spent By Customer
Enabling WooCommerce functionalities only if a “user spent more than X” is not unusual. For example, you may want to display banners, special offers, discounted prices, conditional content to customers who have purchased more than a given dollar threshold. While coding a function that could get the total spent by a user ID, I stumbled upon a WooCommerce function that already achieves that, out of the box: wc_get_customer_total_spent( $user_id ). You can use it as a conditional tag and run a function only when such threshold is reached. So, let’s see how to use it. Enjoy: https://www.businessbloomer.com/woocommerce-get-total-spent-by-customer/









