Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 130709

Set related products according to current product category

$
0
0

Replies: 0

Hi,
I’m developing an e-shop that sells men and women clothes where “men” and “women” are woocommerce categories among others.
Basically I would like to customize related products so that they don’t show “men” products if I’m in a “women” product page and vice versa.
I guess I need to use

add_filter( 'woocommerce_product_related_posts_relate_by_category', function() {
    //and add some conditions here
});

but I don’t know the conditions to point the current product category and the “man”-“women” category.
Am I on the right path?
Thank you for any answer


Viewing all articles
Browse latest Browse all 130709

Trending Articles