Firstly, this conditional returns true on category archives for Woo Commerce and NOT single product page.
Try using the actual slug in lowercase or the i.d.
Example:
if ( is_product_category( 't-shirt' ) ) {
Your code looks like its wrong because it includes too many brackets.
Woo suggest using the slug in their Docs.
This is the correct conditional which returns true on a single product page.
is_product()
Here’s all the Woo hooks & conditional tags you can use in custom functions from your child themes functions file.
Related Posts:
- Send an email when custom post type category is changed
- functions.php conditional tag – only show in single.php?
- How to access deleted term inside delete_product_cat action
- Hook when category is added to post
- Prevent function from triggering again when post in specific category gets another category?
- has_category() for parent category
- Conditional Tag for sub cagtegories?
- Action hooks returning old category instead of new category
- Remove word “Category” from WooCommerce product page [closed]
- Replace category titles
- Same Conditionals Not Working on Two Different Hooks
- How to add custom script to the particular Product Category page
- How to remove the “+Add Category” button from the Category metabox?
- Hide posts of a certain category unless logged in
- Add title, post content, and category like add_post_meta and update_post_meta
- Which are the hooks run before/after when a category’s deletion?
- Set the default category of an attachment
- Assign category from custom field on post creation and update
- How to hide category name
- Categories widget show empty?
- Is there a reason I cannot get the current category in a loop?
- Echo text using is_tag
- Filter WooCommerce archive pages by an additional category
- Conditional category & tag statement
- How to load several hierarchical categories from functions.php
- create function to call category name and slug
- How to hide a category or tag everywhere EXCEPT for use with get_posts
- Regarding Tags And Categories
- Get_term_meta() does not work with pre_get_posts()
- Correct Hook/Filter to amend category choices on post edit page
- Sidebar by Category Conditional Statement not functioning
- How to delete WooCommerce categories in bulk that only have one product
- Ajax Category add doesn’t update the list table custom column
- How to hook into creating a category?
- Multiple if statements with else for get_the_category [closed]
- get categories the post was in and just been removed from
- How can I hide the category term for posts with none set?
- Modify functions.php to add a term ‘uses-theme’ set to theme name on post save
- How to display the category featured images [closed]
- Hook action when create new category [duplicate]
- Weird html output of single_cat_title – is not inside of the html element?
- Replace category titles inside RSS feed
- How to display only 3 main categories, separated by commas, since they are marked in the post?
- Create terms when registering taxonomy?
- List Categories of the Parent Category of the Current Category
- Link each category to last post
- Auto add pages to category menu
- Removing the number in a category slug
- Conditionally call add_action depending on post_type?
- Get term by slug in Gutenberg
- Show only first children level of current category?
- Problem displaying one post from each category
- How do I automatically put categories and their descriptions on a WP Page?
- Taxonomy filter all children
- RSS/XML of all Categories and/or Tags
- URL path for wordpress categories
- How do I get rid of “category” from my URL structure?
- Send push when new post is published in a certain category
- Have different permalinks based on category
- How do I output all category with custom field?
- Add /category/ to an author archive page
- Remove subcategory and category with some rules from permalink
- How can I edit the ‘Most Used’ tab in the categories meta-box to show another custom taxonomy?
- How to remove specific categories from posts?
- how to get full category path including parent and subcategories
- How can I output all apply_filters and do_action?
- Categories are not listing their respective products
- Use remove_meta_box conditionally on custom post type
- Two columns in homepage each with one category
- Pagination on category.php and tag.php not working
- Hook add_attachment error
- How do I attach a page to a category similar to how we attach media to a post?
- Display all product tags associated with a specific product category
- How replace individual elements in the RSS feed with a single string
- how to nest specific category thumbnails inside different containers
- Adding a block with query in homepage
- multiple values in an array for category__and does not work with WP_Query
- Add properties to term object
- Display all Categories
- custom wp_list_categories in single.php
- How to target all woocommerce categories that don’t have any subcategories in them?
- echo $category[0]-> cat_name; shows only one category name
- How can i echo next and previous custom category from a Taxonomy
- Change post category within pre_get_posts
- taxonomy_edit_form_fields output after term fields
- $new_pass always returns null – password_reset hook
- how to get postmeta info based on multiple categories?
- create post with main category and other categories from admin panel
- showing tag beside catagory
- get_posts – require all categories
- Add advertising box to a specific category page
- How do you add Author and date Published on Category Pages?
- Twenty Eleven Theme [duplicate]
- display certain category on custom template page
- Get post by Category in custom template
- List products from current category
- Assign a category by user and customize the edit-tags.php?taxonomy=category page
- comments_number fails to print
- How to show posts of a specific category
- How to show child category name & post from it’s parent [closed]