I need to make some different things for each product page in Woocommerce, so I was thinking to use something like:
is_product('My Product Name')
But no luck with it. How could I do it?
I need to make some different things for each product page in Woocommerce, so I was thinking to use something like:
is_product('My Product Name')
But no luck with it. How could I do it?
You must be logged in to post a comment.
Product titles are subject to change.
Check against an immutable reference instead, like the product ID:
is_single(31950)
Verify that you are checking a product page as well:
is_single(31950) && is_product()
is_product – Returns true when viewing a single product. So thats not what you need.
You need to check if the product title is x.
Somethig like:
$product_title = get_the_title();
if( $product_title == “your title”) // do something