This is mostly a PHP question and it is related to WooCommerce. Either of which conditions makes it dangerously close to off-topic. However, I am going to give the benefit of the doubt and assume that the problem is due to a misunderstanding of the WordPress function wp_get_post_terms(). 😉
wp_get_post_terms() returns all of the terms as an array of term object. By using array_shift() the way you are you are truncating that list down to one. Remove array_shift() and create a loop.
$product_cats = wp_get_post_terms( get_the_ID(), 'product_cat' );
// var_dump($product_cats); // debug
if ( $product_cats && ! is_wp_error ( $product_cats ) ){
while (!empty($product_cats)) {
$single_cat = array_shift( $product_cats ); ?>
<h2 itemprop="name" class="product_category_title"><span><?php echo $single_cat->name; ?></span></h2><?php
}
}
Related Posts:
- Display All Products by Category with WooCommerce
- Woocommerce get category image full size
- Programmatically create product category and add thumbnail in woocommerce
- Create product category and keyword search form in woocommerce? [closed]
- Category links suddenly started giving 404 errors
- How do I edit pre_get_post for the category the user is currently in?
- Display WooCommerce product categories in a 4 columns custom menu [closed]
- Hide uncategorized products from the shop page
- Display “add to cart” button on every listing in product category page?
- Get woocommerce catogry
- How to enable category hierarchy for links?
- Set post categories to include parents when setting child category
- Woocommerce category show subcategories only/omit posts for specific category
- Omit specific product categories from WooCommerce shortcode
- WC 3.x Get categories from variable product of the cart
- Class active for Archive link – looped out
- Why do my categories redirect?
- need to add custom field in more products
- How to redefine the sorting of product categories by menu_order?
- Pagination not visible on woocommerce’s category page
- Pagination is not working properly in Product Category/Tag pages
- Best way of getting WooCommerce category path
- How to recreate a copy of a product category in WooCommerce? [closed]
- Get parrent category name
- Sorting category products not working
- Get category url in loop
- Change thumbnail image depending product category
- Woocommerce custom category pages
- Style category link depending on category ID
- Building Menu from Woocommerce Product Categories
- Get paged category link programmatically
- Do not show sub categories in the loop on archive-product.php
- List just subcategory and products of active category page in Woocommerce
- Link To Child Category For A Post
- List a maximum of ‘x’ product categories with qty of ‘y’ in each column
- why get_the_post_thumbnail( the_ID()) echos extra post id
- How to access deleted term inside delete_product_cat action
- Apply WordPress function on specific woocommerce product categories only
- Filter WooCommerce archive pages by an additional category
- Grandchild Term Things Grandfather Term is It’s Parent
- Custom tax_query filter not working for Woocommerce product categories
- How do order product categories – on a parent category page – in Woocommerce?
- Woocommerce filter function not updating
- Adding custom ID field to the categories
- How can i change what one category displays?
- Remove any product that is featured from regular display loop [WooCommerce]
- Two Sections on Woocommerce Catergory Page [closed]
- Woocommerce search form with category select
- How to display product with two condition, category and brand taxonomy
- Show different menu on each woocommerce category page
- How to not display a category post on blog page?
- Link from navbar to categories
- WooCommerce shared categories
- Displaying Single Product Page Parent and Child Category
- How to list posts from a sub-category that is listed in a parent category (more details below)?
- category description not showing in my woocommerce
- Conditional label Woocommerce archive [unsolved]
- How to show given products only using product id array from specific category page in woocommerce
- Shop Category Pages missing s
- WooCommerce REST API not returning the default products category
- How to show WooCommerce Categories on ‘shop’ page instead of products?
- Show the parent taxonomy by creating shortcode in woocommerce?
- When creating a new product, auto assign it to all custom taxonomy woocommerce
- Get WooCommerce product category list in functions.php
- in post content shortcode works, but hardcoded in same page template doesn’t?
- Is there a reason to put a product in both the Child and Parent Categories?
- WordPress category title not update in navigation menu
- WooCommerce showing active product categories on single product page
- How to fix 404 error in pagination in categories of woocommerce with common url base /shop/?
- How to display custom fields as table in Woocommerce
- How do I merge WooCommerce categories with the same name?
- How to delete WooCommerce categories in bulk that only have one product
- Product Category page showing all products
- product_cat image url from database
- Show Subcategory Name Instead of Parent Category
- Woocommerce product catalog, products with different description
- Link For Portfolio Categories
- WooCommerce – Get products from category right before deleting category
- set a parent category in a product woocommerce
- No results found for second level category
- How to display products with multiple conditions, product_id and category_id
- Categories and Tags Conflict after Woocommerce Installation
- How to get related category/categories in WordPress archive page
- How to get the link of all categories
- woocommerce – products by category slug? [closed]
- How can I add a Categories page link to a menu? [closed]
- Featured image for links and categories
- Categories as selectable links on submission form
- Custom Woocommerce Category view
- WooCommerce category display in custom page
- Woocommerce – Display product category of product in Orders page
- Changing Woocommerce categories programatically
- Get all categories
- Woocommerce Force the category choice before creating new product? [duplicate]
- Function to reference post meta in place of category Woocommerce
- Add custom fields to Woocommerce Category Page
- Restricted category in Woocommerce [closed]
- category id (term_id) in url instead of slug
- What would be the easiest way to show subcategories under specific parents as text links only?
- How can I display the category descriptions below the category name using a functions.php filter?