Get Total Downloads for each Vendor

22 Views Asked by At

I use Easy Digital Downloads and EDD All Access. My website is a subscription, on my website there are products from several vendors. Users who have subscribed can download products from any vendor.

Each vendor has its own page, I want to display Total Downloads for each vendor, Total Downloads is the total of all products that have been downloaded from that Vendor.

 <?php

if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}

global $post;
if ( is_singular( 'download' ) ) {
    $author = new WP_User( $post->post_author );
} else {
    $author = fes_get_vendor();
}

if ( ! $author ) {
    $author = get_current_user_id();
}

$vendor =new FES_Vendor( $author->ID ,true );
$author_id = get_the_author_meta('ID');

?>

<div class="total-downloads">
    <span class="total-number"><?php echo esc_html($vendor->sales_count); ?></span>
    <span class="total-text"><?php esc_html_e('Downloads','notisnal')?></span>
</div>

But it displays total purchases of the product, not total downloads. How can I display Total Downloads of all products for each Vendor?

0

There are 0 best solutions below