Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1367415

    Hello

    we have a product category widget in the single product page

    I am hiding an element in this way
    li.cat-item.cat-item-462 {
    display: none;
    }
    and it works

    But google anyway ignores that it is hidden and counts that there are 700 or more redirects on the site caused by this, and this is bad

    How can hide that element (product category) in PHP instead of CSS?

    Thank you
    Mauro

    #1367496

    Hey profumopuntoit,

    Can you try to add this PHP code in functions.php of your child theme:

    add_filter( 'woocommerce_product_categories_widget_args', 'rv_exclude_wc_widget_categories' );
    function rv_exclude_wc_widget_categories( $cat_args ) {
    	$cat_args['exclude'] = array('55','68'); // Insert the product category IDs you wish to exclude
    	return $cat_args;
    }

    Just change the category ID.
    For further information, please check this article: https://www.engagewp.com/remove-categories-woocommerce-product-category-widget/

    Best regards,
    Nikko

    #1367546

    Thank you Nikko,

    but unfortunately it does not work
    I have added

    add_filter( ‘woocommerce_product_categories_widget_args’, ‘rv_exclude_wc_widget_categories’ );
    function rv_exclude_wc_widget_categories( $cat_args ) {
    $cat_args[‘exclude’] = array(‘462’); // Insert the product category IDs you wish to exclude
    return $cat_args;
    }
    but category it is still there in the code

    there is a comment in that post which says
    #######################
    Hello,
    This code is no more working in Woo Version 6.5.1
    Can you please send me the updated version of this code ?
    Nand
    ########################
    Our WooCommerce Version is 6.8.2

    Mauro

    #1367772

    Hi Mauro,

    The code should still work, there’s a comment there that it does not work, however, there’s one response to it as well that it works.
    Also, you can check woocommerce’s code and see that the filter is still there.
    Please post us your login credentials (in the “private data” field), so we can take a look at your backend.

    1. Install and activate ” Temporary Login Without Password “.
    2. Go to ” Users > Temporary Logins ” on the left-side menu.
    3. Click ” Create New “.
    4. Add the email address for the account ( you can use (Email address hidden if logged out) ), as well as the ” Role ” making that the highest possible and the expiry about four days
      ( to be sure that we have enough time to debug ).
    5. Click ” Submit “.
    6. You’ll now have a temporary account. Please provide us here in the private section the URL, so we can login and help you out.

    When your issue is fixed, you can always remove the plugin!
    If you prefer to not use the plugin, you can manually create an admin user and post the login credentials in the “private data” field.

    Best regards,
    Nikko

    #1368286
    This reply has been marked as private.
    #1368360

    Hi Mauro,

    Thanks for providing us with admin access.
    Can we request for FTP access as well? since Theme File Editor has been disabled.

    Best regards,
    Nikko

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.