WC_Customer_Download::get_download_count()
Get download_count.
Method of the class: WC_Customer_Download{}
No Hooks.
Return
Int
.
Usage
$WC_Customer_Download = new WC_Customer_Download(); $WC_Customer_Download->get_download_count( $context );
- $context(string)
- What the value is for. Valid values are 'view' and 'edit'.
Default: 'view'
WC_Customer_Download::get_download_count() WC Customer Download::get download count code WC 9.4.2
public function get_download_count( $context = 'view' ) { // Check for count of download logs. $data_store = WC_Data_Store::load( 'customer-download-log' ); $download_log_count = $data_store->get_download_logs_count_for_permission( $this->get_id() ); // Check download count in prop. $download_count_prop = $this->get_prop( 'download_count', $context ); // Return the larger of the two in case they differ. // If logs are removed for some reason, we should still respect the // count stored in the prop. return max( $download_log_count, $download_count_prop ); }