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 detect /category and /tag base pages?
- WordPress: Using the category slug get the category ID using mysql query
- Custom Portfolio Page
- Category Template – Show Last Entry as Featured
- How to get the deleted category id?
- Maintaining a separate posts page for certain categories and don’t show those on home page
- Custom Fields Value As Taxonomy
- Create a Category with a front-end post
- Update custom category fields front-end
- Detect category choice for posts with multiple categories
- Subcategory is displayed before Parent Category
- wp_insert_link not working
- Shortcode to display all the post from a category in a page
- Exclude the category in WordPress
- wp_list_pages() not showing on posts
- How can assign posting to Subscriber to specific category?
- Is custom menu name and category name linked in wordpress?
- WP Category Meta plugin fix? [closed]
- WP SQL Categories Export and Import
- Are tags different than categories?
- Assign a list of categories with a parent category
- list all child categories that apply to current post even if those cats are empty?
- Check for parent category
- Custom post type archive category page results in 404
- Change status of page after an event (Looking for best practice advice)
- Last x Posted Categories?
- Exclude categories from postquery
- Category pagination not working
- I need advice on how to structure the categories according to the layout i have
- Check boxes for showing categories
- How to add image for all posts associated to specified category?
- How to get posts using category slug in ClassiPress?
- Show the current post’s category, without displaying parent category
- show only sub categories if available?
- List Categories By Specified First Character
- Best way to categorize/populate a magazine style layout
- the category city made as a subdomain
- Mass Update User Profile Checkbox Options
- What is the best way to add an advanced / intermediate / beginner tag to a post
- Header Link function not working. Problem with bloginfo()
- Category sticky latest
- WordPress category filters as subcategories
- Sort posts alphabetically by category/custom taxonomy, insert divider between different types
- How can I exclude a category from the main loop with the category name & not ID?
- get all categories’ latest post in one query
- Categories show 404 error on multisite installation
- Need help with major category and permalink re-organization
- Show posts from category specified using a custom field
- Include home page template in specific category template
- How to get sub-categories to display same look as there parents
- Combining these queries? (Same taxonomy term + same category as post)
- query_post problem
- Explode() expects a string
- Get a list of all links on a page?
- Unable to browser posts in categories
- How to add meta description, keywords, custom title to a category template
- Custom menu with categories and tags
- User level categories