Wordpress - Get tag id by slug
$tag = get_term_by('slug', ' hedoms','post_tag');$tag_id = $tag->term_id;
OK i have found the solution.
I set on the get_term_by the taxonomy 'post_tag' instead 'product_tag' as it woocommerce tags. Next time i will look carefully on the url of the wp-admin when i am looking on taxonomy page:
...wp-admin/edit-tags.php?taxonomy=product_tag&post_type=product
So the code should be like that:
$tag = get_term_by('slug', $slug, 'product_tag'); $tag_name = $tag->name; <h1><?php echo $tag_name; ?></h1>
Solved.