How do I hide or remove attribute and product categoy Count

This topic has 16 replies, 3 voices, and was last updated 7 years, 3 months ago ago by Rose Tyler

  • Avatar: shoparah
    shoparah
    Participant
    July 24, 2017 at 05:15

    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.

    15 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    July 26, 2017 at 15:58
    Avatar: shoparah
    shoparah
    Participant
    July 26, 2017 at 16:53

    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.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    July 27, 2017 at 08:46

    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

    Avatar: shoparah
    shoparah
    Participant
    July 27, 2017 at 17:55

    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>

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    July 28, 2017 at 08:59

    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

    Avatar: shoparah
    shoparah
    Participant
    July 28, 2017 at 16:34

    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.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    July 31, 2017 at 08:47

    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

    Avatar: shoparah
    shoparah
    Participant
    July 31, 2017 at 17:24

    I’ve included FTP access in private content. Please check.

    Thank you.

    Please, contact administrator
    for this information.
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    August 1, 2017 at 09:49

    Hello,

    Please also provide wp-admin credentials.

    Regards

    Avatar: shoparah
    shoparah
    Participant
    August 1, 2017 at 17:34

    Please see private content.

    Please, contact administrator
    for this information.
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    August 2, 2017 at 08:25

    Hello,

    Fixed. Please check now.

    Regards

    Avatar: shoparah
    shoparah
    Participant
    August 2, 2017 at 16:20

    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.

    Avatar: amzy
    Amzy Leel
    Participant
    August 3, 2017 at 06:41

    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)

    Avatar: shoparah
    shoparah
    Participant
    August 3, 2017 at 08:40

    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.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    August 3, 2017 at 09:05

    Hello,

    I simply changed woocommerce category element to our, you can see it in shop page editor and http://prntscr.com/g3rsox

    Regards

  • Viewing 16 results - 1 through 16 (of 16 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.