Product count in archive page Title in WooCommerce

How to show in the archive page TITLE, the number of products, in WooCommerce? Thanks!

Topic woocommerce-offtopic plugins Wordpress

Category Web


add_filter( 'woocommerce_page_title', 'add_products_number_to_category_title', 99, 1 );
function add_products_number_to_category_title($title) {
    if ( ! is_product_category() ) {
        return $title;
    }
    
    $products_count = get_queried_object()->count;
    
    return $title . ' (' . esc_html( $products_count ) . ')';
} 

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.