WooCommerce has a built in product_tag
url filter as such:
https://my-url.com/my-page/?product_tag=my-slug
Bringing back all the product_tag
s with the given slug in the url.
I am trying to do something relatively simple, retrieve the name of the product_tag
and put it in a text heading block so the visitor knows what it is filtering.
The only thing I was able to figure out is in my woocommerce template page woocommerce-page.php
is latching onto the global variable $wp_query
And then putting the product tags slug in a variable.
$producttag = $wp_query->query['product_tag'];
Questions:
Is this an appropriate way to retrieve the product tag slug? How do I convert the product slug into its actual Name?
Or is there a way to bypass the slug altogether and just get the product tags name?
The only way I found how to get these variables was by looking at $wp_query
, and that only returns the slug.