Woocommerce – if is specific product

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')

Read More

But no luck with it. How could I do it?

Related posts

Leave a Reply

2 comments

  1. 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()

  2. 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