is_product_tag()WC 1.0

Is_product_tag - Returns true when viewing a product tag.

Uses: is_tax()

No Hooks.

Return

true|false.

Usage

is_product_tag( $term );
$term(string)
The term slug your checking for. Leave blank to return true on any.
Default: ''

Examples

0

#1 Find out if we are on a WooCommerce product tag page

if( is_product_tag() ) {
	// this is the product tag page
}
else {
	// this is another page (not the product tag)
}
0

#2 Check that we are on a certain product tag page

Check the product tag page for the 'custom-tag' slug:

if( is_product_tag( 'custom-tag' ) ){
	// product tag 'custom-tag'
}

Let's check by taxonomy term ID:

if( is_product_tag( 55 ) ){
	// tag with ID 55
}

Let's check several tags at once - whether we are on the page of any of them:

if( is_product_tag( [ 50, 55 ] ){
	// this is a page of one of the tags with ID 50 or 55
}

is_product_tag() code WC 8.6.1

function is_product_tag( $term = '' ) {
	return is_tax( 'product_tag', $term );
}