I want to add %country%
to the product URL. Under %country%
, I mean $woocommerce->customer->get_country()
. At least as a parameter, like domain.com/shop/productname?country=germany
. But in the end, I want to achieve something like domain.com/germany/shop/productname
.
I tried to do something with the following functions:
add_rewrite_endpoint()
add_rewrite_rule()
add_rewrite_tag()
But all the code examples that I have met put me stumped. I'm not very good in routing. If someone describes my case - I will be very grateful!