Here’s a short tutorial for Easy Digital Downloads that adds a download’s sales and download count to the Download Details widget, found under Appearance → Widgets. If you’d like to show the counts somewhere else, simply call each function and pass in your download’s ID.

The Download Details widget shown on the 2013 theme

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


  1. Hi,
    I’m using EDD and I wanted i download counter but with your solution It does not work
    1- I’m using a custom theme and I have not your widget. Can you tell me how to add it to my theme.
    2- with your code It always show me 0 for the downloads !!?
    – Can you please post a step by step solution Thank you in advance.

    PS: I don’t have any programming skills.

    1. This tutorial is designed to work with the widget that EDD provides, it’s not a widget I have built. Go to the widgets section and drag the “download details” widget into your widget area. How are you using the code when it’s showing 0? can you show me an example?

  2. Looks like my post got deleted. i’ll try again.

    How can i show total sales for all the products combined? like if i have 5 products, how, i need a way to add up all sales into one.


    1. Posts needs to be moderated if you’re a first time poster, it didn’t get deleted. I’ll see if I can put together a tutorial to show your total sales count, of all downloads combined.

  3. Hi I am having a little trouble writing an if else statement for this. Basically I found a small problem with this snippet of code. If a user has 1 sale, it says 1 sales. I am wondering how to make it say sale for 1 sale and sales for anything else. I hope that makes sense.

          1. I am new to php.
            How can I call this function to have the counts show in the Add To Cart area (and before the product list).

  4. Above snippets not working for me. I’m trying to display the total number of downloads per a specific download. As such I’m using your function:

    function sumobi_edd_get_download_count( $download_id = 0 ) {
    global $edd_logs;
    $meta_query = array(
    ‘relation’ => ‘AND’,
    ‘key’ => ‘_edd_log_file_id’
    ‘key’ => ‘_edd_log_payment_id’

    return $edd_logs->get_log_count( $download_id, ‘file_download’, $meta_query );

    With a download ID of 192 (which has 1 download) I do:

    $tot_dl = sumobi_edd_get_download_count(192);
    echo $tot_dl;

    No matter what I do, like the poster above, I am returned with 0 sales/downloads.

  5. hello Sumobi, you refer this : try this: for showing total sales of the store.

    I am newbie, I see there is a code,

    But can you please tell me how to use this code?

    ## For an examples, If I wanted to show my store Total Downloads/Sales from the beginning (Including Free Downloads) on to site header or footer in a big word and once there is another sale the count will add up as well?

    Hope you understand my point, if not please feel free to mention in your comments.


Comments are closed.