• Hola, mi problema es que estoy intentando organizar las categorias de producto, y en la pagina de la tienda me salen algunos productos repetidos en otras categorias que yo no he asignado. Por ejemplo “camisetas mujer” me aparece en una categoria aparte y ademas dentro de la categoria “padre” que es “ropa de mujer” y solo quiero que me aparezcan dentro de la categoria padre.
    En fin que me aparece todo bastante desorganizado, por mas que compruebo las categorias asignadas a cada producto.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi,

    We could not get your query properly. Do you want to customize the category on the shop page? If so, could you go to the Appearance > Customize > WooCommerce and under Category display choose the option as you like to display.
    Also, can you post your query in English so that we could get what you want to achieve and provide you with a better solution?

    Thanks.

    Thread Starter yogy

    (@yogy)

    Thank you, I’ve already solved it, I’ve changed the shop’s page and it seems that it’s more organized.
    Only one thing … in the product categories I get all including those tagged in slider and uncategorized. How can I hide those two categories on the shop’s page?

    Hi,

    For hiding the specific category, you need to override the function showing the category. First of all, you need to make a child theme.
    You can take a reference on how to make a child theme form the link below:
    https://themegrill.com/blog/tutorial-creating-wordpress-child-theme/

    After creating a child theme, you need to insert the below-mentioned code inside the function.php of the child theme.

    function hide_category_terms( $terms, $taxonomies, $args ) {
     
    	$new_terms 	= array();
    	$hide_category 	= array( 27, 23 ); // Ids of the category you don't want to display on the shop page
     	
     	  // if a product category and on the shop page
    	if ( in_array( 'product_cat', $taxonomies ) && !is_admin() && is_shop() ) {
    	    foreach ( $terms as $key => $term ) {
    		if ( ! in_array( $term->term_id, $hide_category ) ) { 
    			$new_terms[] = $term;
    		}
    	    }
    	    $terms = $new_terms;
    	}
      return $terms;
    }
    add_filter( 'get_terms', 'hide_category_terms', 10, 3 );

    Also, ids need to be different. Go to the category in the dashboard and hover over the category, there at URL below, id will be shown. Insert the id of the category you want to hide in the $hide_category option. Save and reload the site and it will be hidden.

    Thanks.

    Thread Starter yogy

    (@yogy)

    Thank you but I do not know how to work with codes, and I see that to make a child theme it is necessary to know, I find it very complicated, there is no other solution?

    Hi,

    There is a workaround using the CSS. You can go to the Appearance > Customize > Additional CSS in the dashboard and insert the code mentioned below:

    .post-type-archive-product li.product-category img[alt="Uncategorized"], 
    .post-type-archive-product li.product-category img[alt="Uncategorized"] + .woocommerce-loop-category__title,
    .post-type-archive-product li.product-category img[alt="Slider"], 
    .post-type-archive-product li.product-category img[alt="Slider"] + .woocommerce-loop-category__title{
    	display: none !important;
    }

    Thanks.

    Thread Starter yogy

    (@yogy)

    Solved! Thanks!!

    Hi,

    Glad to know it worked. Feel free to ask again if you get any issue regarding the theme. If you liked this theme, you can help us by leaving a review.

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Categorias’ is closed to new replies.