wordpress - Category name with total number of product in that category in woocomerce -
can explain me how show category title number of product in category in category archive page category 1(10)
the url http://www.example.com/product-category/category-1/
can me.............. have tried display total product of website. want product in category
<h1><?php woocommerce_page_title(); global $woocommerce_loop; do_action( 'woocommerce_before_subcategory', $category ); echo apply_filters( 'woocommerce_subcategory_count_html', ' <mark class="count">(' . $category->count . ')</mark>', $category ); ?> </h1>
to list categories along product count:
$terms = get_terms( 'product_cat' ); foreach( $terms $term ) { echo 'product category: ' . $term->name . ' - count: ' . $term->count; }
if have category id:
$term = get_term( cat_id, 'product_cat' ); //replace category id here echo 'product category: ' . $term->name . ' - count: ' . $term->count;
Comments
Post a Comment