Reputation: 540
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?
Upvotes: 1
Views: 12253
Reputation: 8712
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()
Upvotes: 9
Reputation: 515
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
Upvotes: 3