How to Display Total Products Count in WooCommerce

This a handy WordPress code snippet which can be used to display the total products count in your WooCommerce shop. To do this, we are going to use WP_Query. 

Useful Read: How to Hook Into WooCommerce to Trigger Something After an Order is Placed

$args = array( 'post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => -1 );
$products = new WP_Query( $args );
echo $products->found_posts;



Leave a Comment.