Skip to content

Instantly share code, notes, and snippets.

@farookibrahim
Created June 23, 2020 16:18
Show Gist options
  • Select an option

  • Save farookibrahim/72a27233131e01b2590037c592042c37 to your computer and use it in GitHub Desktop.

Select an option

Save farookibrahim/72a27233131e01b2590037c592042c37 to your computer and use it in GitHub Desktop.
Cartzilla - Display Free Downloads WooCommerce plugin downloads count instead of sales count
if( ! function_exists( 'cartzilla_mp_loop_product_sold_count' ) ) {
function cartzilla_mp_loop_product_sold_count() {
global $product;
$product_id = $product->get_id();
$download_count = get_post_meta( $product_id, 'somdn_dlcount', true ) ? intval( get_post_meta( $product_id, 'somdn_dlcount', true ) ) : 0 ;
if ( $download_count > 0 ) {
?>
<div class="font-size-sm mr-2">
<?php echo apply_filters( 'cartzilla_sold_count_icon_icon', '<i class="czi-download text-muted mr-1"></i>' ); ?>
<span class="font-size-xs"><?php echo esc_html( sprintf( _nx( '%s Download', '%s Downloads', $download_count, 'front-end', 'cartzilla' ), $download_count ) ); ?></span>
</div><?php
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment