This topic has 16 replies, 3 voices, and was last updated 7 years, 3 months ago ago by Rose Tyler
Hello,
How do I hide the attributes and product category COUNT that appears on my shop page showing how many products I have in each category and attribute? Is there a code I can add on my child theme style.css?
Thank you.
Hello,
Please read this topic https://www.8theme.com/topic/remove-porduct-category-product-count/
Regards
I have a child theme. To make the changes in my child theme can/should I copy the wp-content/themes/legenda/woocommerce/content-product_cat.php file and put it into my child theme folder? Then in my child theme folder make the changes in the content-product_cat.php file?
Please tell me the steps.
Thank you.
Hello,
Yes, you need to create empty woocommerce folder in your child theme, then copy content-product_cat.php file into this folder and make changes.
Regards
Oops I replied to the other link forum here’s what I wrote:
I copied the folder into my child theme under a woo commerce folder I already previously had in my child theme. However when copy pasting the code at the bottom of content-product_cat.php and saving it it would just show those words on my front end shop page and didn’t hide the count it did not work.
I noticed in the php folder the code you’re telling me to add into the file already exists, as you can see below I copy pasted the entire code from the folder below and the code already exists in there:
<?php
/**
* The template for displaying product category thumbnails within loops.
*
* Override this template by copying it to yourtheme/woocommerce/content-product_cat.php
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.6.1
*/
if ( ! defined( ‘ABSPATH’ ) ) exit; // Exit if accessed directly
global $woocommerce_loop;
// Store loop count we’re currently on
if ( empty( $woocommerce_loop[‘loop’] ) )
$woocommerce_loop[‘loop’] = 0;
// Store column count for displaying the grid
if ( empty( $woocommerce_loop[‘columns’] ) )
$woocommerce_loop[‘columns’] = apply_filters( ‘loop_shop_columns’, 4 );
// Increase loop count
$woocommerce_loop[‘loop’]++;
if ( etheme_get_option( ‘product_page_image_width’ ) != ” && etheme_get_option( ‘product_page_image_height’ ) != ” ) {
$image_size = array();
$image_size[] = etheme_get_option(‘product_page_image_width’);
$image_size[] = etheme_get_option(‘product_page_image_height’);
} else {
$image_size = apply_filters( ‘single_product_large_thumbnail_size’, ‘shop_catalog’ );
}
?>
<div class=”span4 product-category <?php
if ( ( $woocommerce_loop[‘loop’] – 1 ) % $woocommerce_loop[‘columns’] == 0 || $woocommerce_loop[‘columns’] == 1)
echo ‘ first’;
if ( $woocommerce_loop[‘loop’] % $woocommerce_loop[‘columns’] == 0 )
echo ‘ last’;
?>”>
<?php do_action( ‘woocommerce_before_subcategory’, $category ); ?>
<div class=”mask-container”>
<?php
$thumbnail_id = get_woocommerce_term_meta( $category->term_id, ‘thumbnail_id’, true );
if ( $thumbnail_id ) {
$image = wp_get_attachment_image_url( $thumbnail_id, $image_size );
echo ‘name . ‘” />’;
} else {
echo wc_placeholder_img( $image_size );
}
?>
<div class=”block-mask”>
<div class=”mask-content”>
slug, ‘product_cat’ ); ?>”><i class=”icon-link”></i>
</div>
</div>
</div>
slug, ‘product_cat’ ); ?>”><h5>
<?php
echo $category->name;
if ( $category->count > 0 )
echo apply_filters( ‘woocommerce_subcategory_count_html’, ‘ (‘ . $category->count . ‘)’, $category );
?>
</h5>
<?php
/**
* woocommerce_after_subcategory_title hook
*/
do_action( ‘woocommerce_after_subcategory_title’, $category );
?>
<?php do_action( ‘woocommerce_after_subcategory’, $category ); ?>
</div>
If you already have this code in child theme simply comment this part
if ( $category->count > 0 )
echo apply_filters( 'woocommerce_subcategory_count_html', ' (' . $category->count . ')', $category );
or provide me your FTP access in Private Content.
Regards
What I’m trying to tell you is this code below:
if ( $category->count > 0 )
echo apply_filters( ‘woocommerce_subcategory_count_html’, ‘ (‘ . $category->count . ‘)’, $category );
is already in the child theme folder under woocommerce/content-product_cat.php (i copied the entire code of the content-product_cat.php file in comment above and you can see the line of code you’re telling me to add is already in there).
and the numbers still show? Have you tried this code with woocoomerce 3.3 or latest legenda theme update? It doesn’t work.
Hello,
Did you try to comment the code in your child theme?
for example,
// if ( $category->count > 0 )
// echo apply_filters( 'woocommerce_subcategory_count_html', ' (' . $category->count . ')', $category );
or delete this code.
I need your FTP access to be able to check your files.
Regards
I’ve included FTP access in private content. Please check.
Thank you.
Hello,
Please also provide wp-admin credentials.
Regards
Please see private content.
Hello,
Fixed. Please check now.
Regards
Hello,
Yes the product category count is removed on my shop page thank you. However on the attributes(on the left side of my shop page and brands pages) the count is still showing.
Hello,
I think you’ve changed the password you provided above.
Unable to login now.
Add this code in custom css or in Appearance >> editor >> style.css
.widget_layered_nav ul li .count { display: none !important; }
to hide the count attributes(on the left side of my shop page and brands pages)
Yes that worked for the attribute count thank you!
For future reference can you tell me how you removed the product category count so I know where that code is as the original steps given to me did not work? I guess Rose Tyler on here made that correction and I’m curious to know how that was done as well?
Thank you.
Hello,
I simply changed woocommerce category element to our, you can see it in shop page editor and http://prntscr.com/g3rsox
Regards
You must be logged in to reply to this topic.Log in/Sign up