Home › Forums › WoodMart support forum › Delete categories of Related Products
Delete categories of Related Products
- This topic has 11 replies, 2 voices, and was last updated 7 months, 2 weeks ago by Aizaz Imtiaz Awan.
-
AuthorPosts
-
April 25, 2024 at 2:53 pm #560660
nax1toParticipantHello, 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.April 25, 2024 at 4:09 pm #560716
Aizaz Imtiaz AwanKeymasterHello,
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.
April 25, 2024 at 4:42 pm #560747
nax1toParticipantI 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.April 26, 2024 at 10:04 am #560931
Aizaz Imtiaz AwanKeymasterHello,
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.
April 26, 2024 at 1:20 pm #561033
nax1toParticipantHello, 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.April 26, 2024 at 2:38 pm #561063
Aizaz Imtiaz AwanKeymasterHello,
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.
April 27, 2024 at 12:19 am #561200
nax1toParticipantHello, 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.
April 27, 2024 at 10:45 am #561231
Aizaz Imtiaz AwanKeymasterHello,
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.
April 27, 2024 at 1:06 pm #561261
nax1toParticipantHello, 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.April 27, 2024 at 2:49 pm #561289
Aizaz Imtiaz AwanKeymasterHello,
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.
April 28, 2024 at 3:40 pm #561444
nax1toParticipantHello, 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.
April 29, 2024 at 10:47 am #561581
Aizaz Imtiaz AwanKeymasterHello,
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.
-
AuthorPosts
- You must be logged in to create new topics. Login / Register