Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show total sales per author in woocommerce

I'm using wordpress and woocommerce on a site where I have users create accounts so that they can upload their own clothing designs, I then sell these products and for each sale of their design the specific user gets a cut of the sale. I am trying to show the number of sales for each user on my site but can't figure out how to. I just need to be able to call the products created by each user specifically and then get the total sales from each of those products, then combine them into a total sales number for each individual user... can anyone point me in the right direction??

I am able to get the total sales for a single product using the

<?php echo get_post_meta($post->ID, 'total_sales', true); ?>

but I have no idea how to get it for a specific for a user.

like image 748
user3137603 Avatar asked Oct 15 '25 16:10

user3137603


1 Answers

<?php echo wc_get_customer_total_spent($user_id); ?>

like image 72
Yoda - user264474 Avatar answered Oct 19 '25 03:10

Yoda - user264474



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!