The number of sales a download has made from Easy Digital Downloads is displayed on a download’s single product page when either of the following conditions are met:

  1. The Themedd: Download Details widget has been added to the Download Sidebar and Show number of sales has been enabled
  2. Frontend Submissions is installed and activated

The code snippets below show a third option, using theĀ themedd_edd_download_details_options filter hook.

Show the sale count for all downloads

This is useful if you are not using the widget or Frontend Submissions and want to show the sale count for all downloads:

/**
 * Show the sale count for all downloads
 *
 * @return array $args The options for the Download Details
 */
function themedd_snippet_edd_show_sale_count( $args ) {

	$args['sale_count'] = true;

	return $args;

}
add_filter( 'themedd_edd_download_details_options', 'themedd_snippet_edd_show_sale_count' );

Show the sale count for one or more downloads

/**
 * Show the sale count for a specific download
 *
 * Note: Change 1234 to your download ID
 *
 * @return array $args The options for the Download Details
 */
function themedd_snippet_edd_show_sale_count_per_download( $args ) {

	if ( 1234 === get_the_ID() ) {
		$args['sale_count'] = true;
	}

	return $args;

}
add_filter( 'themedd_edd_download_details_options', 'themedd_snippet_edd_show_sale_count_per_download' );

Hide the sale count for one or more downloads

This is useful if the sale count is showing for all downloads (as per the conditions above) but you want to hide the sale count for a specific downloads

/**
 * Hide the sale count for a specific download
 *
 * Note: Change 1234 to your download ID
 *
 * @return array $args The options for the Download Details
 */
function themedd_snippet_edd_hide_sale_count_per_download( $args ) {

	if ( 1234 === get_the_ID() ) {
		$args['sale_count'] = false;
	}

	return $args;

}
add_filter( 'themedd_edd_download_details_options', 'themedd_snippet_edd_hide_sale_count_per_download' );

PHP should be added to your child theme's functions.php file.