multisite: the best way to separate products by gender in woocommerce?

I have been looking for a way to separate the products by gender.

  1. Use multisite to build a separate subsite for the man / woman store.

The advantage is that I can use the same category slug for men and women, for example. xxx.com/man/category/clothing/ … xxx.com/woman/category/clothing / ….

The problem is that some products are unisex, that is, I have to publish twice.

  1. Add a custom taxonomy product genre.

I am currently working on this. But there are some problems:

  • How to deal with permalink?

I found this:
Customized taxonomy term in the WooCommerce product Permanent link

And it really works for the product link.

The link to my product is now like xxx.com/man/category/xxx/product-name for men's products and xxx.com/woman/category/xxx/product-name for women's products.

But when you visit a product category (xxx.com/man(woman) / category / xxx), it will be a 404 error.

  • The slug category can not be the same.

Therefore, I do not know if it is possible to change the permanent link to xxx.com/category/xxx?gender=man(woman) to visit the product category page male (female). And also for the product link.

There is an add-on toolkit, but I do not know if it works.

  1. Establish gender as a product category

Still different slug.

Man

-Clothes clothes)

–Shirt

– …

Woman

-Clothing (clothes-2)

– …

My custom code added to archive-product.php:

$ gender_array = get_the_terms ($ post-> ID, & # 39; gender & # 39;);
$ gender = $ gender_array[0]-> slug; // man for man, woman for woman and woman for unisex

yes ($ gender! = & # 39; woman & # 39;) {
$ args = array (
& # 39; post_type & # 39; => & # 39; product & # 39 ;,
& # 39; tax_query & # 39; => array (
training(
& # 39; taxonomy & # 39; => & # 39; gender & # 39 ;,
& # 39; field & # 39; => & # 39; man & # 39 ;,
)
)
);

$ query = new WP_Query ($ args);
wc_get_template_part (& # 39 ;, & # 39; product & # 39;);

}
/ * elseif ($ gender! = & # 39; man & # 39;) {

$ args = array (
& # 39; post_type & # 39; => & # 39; product & # 39 ;,
& # 39; tax_query & # 39; => array (
training(
& # 39; taxonomy & # 39; => & # 39; gender & # 39 ;,
& # 39; field & # 39; => & # 39; woman & # 39 ;,
)
)
);

$ query = new WP_Query ($ args);
wc_get_template_part (& # 39 ;, & # 39; product & # 39;);

} * /