Although Easy Digital Downloads shows the total spent for each customer under Downloads → Reports → Customers, there’s no way for a customer themselves to see how much they have spent.

The following code will allow you to show a logged in customer how much they’ve spent, anywhere on your website. You could show this on the customer’s purchase history page, or add it to a purchase history dashboard widget.

Copy and paste the following function (mind the opening PHP tag) into your child theme’s functions.php or custom plugin:

Then, you can simply call <?php echo sumobi_edd_get_total_spent_for_customer(); ?>

Alternatively, if you need to show only a specific customer’s total spent, you can pass a user ID into the function like this:

<?php echo sumobi_edd_get_total_spent_for_customer( 50 ); ?>

2 comments

  1. This is amazing. Thank you for writing this. Is there any similar tutorials on how to show amount made or sold. I would love to display amount contribute and amount sold for each user next to each other.

  2. Thanks so much Andrew for publishing this post 🙂 It’s very useful indeed.
    I’m trying to add a new row at the bottom of the table shown on purchase history page for each user, and publish the total amount they spent during a specific time period (e.g. April 1st, 2014 till March 31st, 2015). I’d be really grateful if you could provide your input.

    Cheers,
    Mason

Comments are closed.