Home Forums WoodMart support forum Delete categories of Related Products

Delete categories of Related Products

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #560660

    nax1to
    Participant

    Hello, how can I delete categories of Related Products? or that only the category selected as the main product category appears.
    Thanks.

    Attachments:
    You must be logged in to view attached files.
    #560716

    Hello,

    I have checked your site and the “Related Product” is not showing in the single product page.

    If you have any questions feel free to contact us.

    Best Regards.

    #560747

    nax1to
    Participant

    I know, I have it disabled, because first I need to delete some categories. that’s why I want to know how I can delete categories of Related Products, or that only the category selected as the main product category appears.
    Thanks.

    #560931

    Hello,

    Log in to WordPress.
    Go to “Products” > “Categories”.
    Delete categories by hovering and clicking “Delete”.

    If you have any questions feel free to contact us.

    Best Regards.

    #561033

    nax1to
    Participant

    Hello, you are not understanding me, what I want is to hide some categories in the related products section. I give you an example, I have a bathroom category which in turn some products are also in the category of free shipping, I would like to hide the category of free shipping because I see other products in the category of free shipping that have nothing to do with the bathroom category.
    Thanks.

    #561063

    Hello,

    Sorry to say but we didn’t seem to understand your concern properly. Could you please elaborate on your concern more with some useful Screenshots so that we can better understand and assist you accordingly of what you actually want.

    Best Regards.

    #561200

    nax1to
    Participant

    Hello, I don’t know how to explain it otherwise, it’s really very simple, I just want to hide some categories in the related products section.

    Thanks.

    #561231

    Hello,

    Please add the following Custom CSS code to Theme Settings > Custom CSS > Global Custom CSS:

    .single-product .product :is(.wd-product-cats,.wd-product-brands-links) {
        display: none;
    }

    Best Regards.

    #561261

    nax1to
    Participant

    Hello, thanks for reply. But in that code, where do I include the category that I want to hide?
    Let’s say that in the related products section, products appear within the category of items for cars and another category called express shipments. Well, I want to hide the express shipping category since there are other products within this category that have nothing to do with items for cars.
    Thanks.

    #561289

    Hello,

    Sorry but there is no option in Theme Settings available for that.

    It requires customizations and this is beyond our limitations and support policy.

    Best Regards.

    #561444

    nax1to
    Participant

    Hello, Could this code work?

    add_filter( ‘woocommerce_related_products_args’, ‘woodmart_exclude_related_products_categories’ );

    function woodmart_exclude_related_products_categories( $args ) {
    global $product;

    // Lista de categorías que deseas excluir de los productos relacionados
    $excluded_categories = array(
    ‘category-slug-1’,
    ‘category-slug-2’,
    // Agrega más categorías si es necesario
    );

    // Obtiene las categorías del producto actual
    $product_categories = wc_get_product_category_ids( $product->get_id() );

    // Busca categorías comunes entre las categorías del producto actual y las categorías excluidas
    $intersect = array_intersect( $excluded_categories, $product_categories );

    // Si hay categorías comunes, las excluye de los productos relacionados
    if ( ! empty( $intersect ) ) {
    $args[‘category’] = implode( ‘,’, $intersect );
    }

    return $args;
    }

    Thanks.

    #561581

    Hello,

    Sorry to say it requires customization and beyond our support policy. Additional code customizations are out of our theme support scope.

    Hope you can understand!

    Best Regards.

Viewing 12 posts - 1 through 12 (of 12 total)