I’m guessing you haven’t set or called the $product object, so it can’t access any information in it.
Try inserting global $product
just before your while loop.
If that doesn’t work, try doing a print_r($product->get_categories()
outside of your html for debugging.
Without the rest of your code I cannot suggest anything else. Also, you should either make sure not more than one category per product is assigned, or take care of that in your code too.
Related Posts:
- How to Display Product specific to a category with WooCommerce Plugin? [closed]
- How can I allow commas in tag names?
- Get the category from an ID of a product?
- Restrict individual category combinations
- Restrict access and display for categories
- Qtranslate displays empty categories with get_categories()
- Plugin to set all Posts in a certain Category to a certain Post Format
- How to display a category list in a mediawiki like way?
- How to use get_categories() with Event Organiser plugin
- Set a category for a page
- Show Heirachy of categories in WP Download Monitor
- Custom Post Type Plugin not loading category template and loading 404 instead
- Display content from custom post type if match to main post category
- Getting a List of Categories for Use in a Plugin?
- WordPress category add image field
- WordPress JSON API remove posts from a specific category
- Solutions to repost categories into multisite blogs?
- How to display only subcategory
- Category’s Description field as editor remove tag
- Assign post format to categories
- Using WP Category Lists Plugin to Dynamically Display Category (PHP)
- Calendar Solution: Handling upcoming Dates with Posts?
- Excluding a category from wp_query breaks recent post widget
- Trouble with editing template for “List category posts” plugin
- Any built-in function to associate a post to category through a plugin?
- Display by Category in Admin
- Redirecting thousands of posts that currently have no category in their permalink when changing permalink structure to include category
- Customize permalink wordpress category id
- Automatically Assign Author to Category [closed]
- Custom Pages for Woocommerce Product-Category Pages
- polylang + category/tag custom language link
- How to password protect a category page / not posts?
- How to display taxonomy images with wp_list_categories?
- Using arbitrary paths in page urls
- WordPress “Categories to tags converter” not working. Pointing to import.php instead
- Redirect to another page using contact form 7? [closed]
- How do I rename a category in the menu bar only?
- Ambrosite Next/Previous Post Link Plus or WP next_post_link to cycle through top level category
- Is changing post from category in a large blog a good practice?
- Best/Correct way to add an option to a category
- How to set category correctly for a custom post created by a remote API call?
- .php file for woocommerce edit category? [closed]
- check uncategorized category by default
- Mutliple users editing single document in wordspress
- How to add category and subcategory in WordPress custom code?
- How can recognize post’s category?
- Categories from front-end, checkbox selection doesn’t work
- Category “same post” retreive and display
- Add a new category for posts
- How to overwrite the category template in a plugin
- How to hide featured images of all posts falling under the same category in wordpress?
- how to show all posts of each category in pages
- Custom Post Type same name as Category
- Display posts by alphabetical order
- Adding custom post category to categories widget
- Custom Post Type with Sequence ID
- WordPress default post categories meta box widget
- How to display category list with category featured image
- Getting the same post on my related post
- Precheck fields when I add a new post
- automatically set random featured image by category in wordpress on post
- how can I edit the HTML of yith ajax product filter
- WordPress Categories as a Grid
- Trying to remove a couple categories from shop page
- How to allow editors to only edit certain categories?
- Category as Subdomain for One WP Install
- Taxonomy Category Icon on index page
- Woocommerce categories displayed on every category and shopping page
- woocommerce product search based only title
- How can I display a list of only categories which are marked as ‘featured’ in the backend?
- Related post based on 2 categories
- How to insert category name above post title in a featured pages plugin?
- trying to create simple plugin to filter categories from all authors
- Displaying saved category checked in a plugin?
- WordPress Categories from Plugin
- Showpost and last
- Is it possible to setup Category wise Subsciption?
- How to use categories in the URL with Advanced Custom Fields?
- Filter EVERY category link with my plugin
- Category archive in menu
- CSV file header
- Find And Add Category to Posts
- Retrieve post thumbnails
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- Pagination in category
- Editing “Kahi’s Highlight Used Categories” plugin code – highlighting parent and child category in post page
- single.php fires more than once after clicking on any post to view with different post id each time
- How can I add the custom taxonomy categories to the posts and pages?
- Twitter List Tweets and Delicious Links as Posts
- Display static pages instead of category, in code
- wp_insert_post_data filter to set category
- 404 not found problem with URL rewrite custom category
- Is there a way to combine categories and their hierarchy into the admin listing page?
- Automatically set posts to NoIndex depending on category?
- Save post to category with gravity forms (post_data) [closed]
- Make a Custom template for a specific category in wordpress
- formatting the way posts show up
- How to pre-set WordPress settings for specific posts?
- hide particular category post from front page only [closed]
- How to make horizontal scrolling menu [closed]