Thanks to Mike Jolley (Woocommerce plugin author) for the solution using: wp_get_attachment_image_src
$prod_categories = get_terms( 'product_cat', array(
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => true
));
foreach( $prod_categories as $prod_cat ) :
$cat_thumb_id = get_woocommerce_term_meta( $prod_cat->term_id, 'thumbnail_id', true );
$shop_catalog_img = wp_get_attachment_image_src( $cat_thumb_id, 'shop_catalog' );
$term_link = get_term_link( $prod_cat, 'product_cat' );?>
<a href="https://wordpress.stackexchange.com/questions/200170/<?php echo $term_link; ?>"><img src="<?php echo $shop_catalog_img[0]; ?>" alt="<?php echo $prod_cat->name; ?>" /></a>
<?php endforeach; wp_reset_query();
Related Posts:
- Programmatically create product category and add thumbnail in woocommerce
- Use get_term_children to get the sub category of a parent category for the current post
- Set post categories to include parents when setting child category
- Change thumbnail image depending product category
- How to make product image inherit from category image
- Get WooCommerce product category list in functions.php
- Restrict retrieved terms by category?
- Categories and Tags Conflict after Woocommerce Installation
- get_terms function not returning anything
- Random Featured Image Based on Category
- Display custom taxonomy attached to the post on post single page
- Categories are not listing their respective products
- wp_dropdown_categories not showing option as selected
- Display single category name in woocommerce loop
- Ive got a term (get_term_by) but now I want to filter it by a category it is in?
- Building Menu from Woocommerce Product Categories
- Include WooCommerce product to all child categories
- woocommerce related products by specific categories [closed]
- Get a count of how many times a term or a category is used in posts
- Get Categories Where Taxonomy Equals ‘n’
- Display sibling categories on category page
- Count tags for a specific category
- Do not show sub categories in the loop on archive-product.php
- Category images are not displaying in WordPress
- How to Link to Most Recent Custom Post of Same Term
- List just subcategory and products of active category page in Woocommerce
- List a maximum of ‘x’ product categories with qty of ‘y’ in each column
- Display all product tags associated with a specific product category
- 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
- How do you use the featured image of the most recent post in a category as the background image
- Custom tax_query filter not working for Woocommerce product categories
- How do order product categories – on a parent category page – in Woocommerce?
- set terms to category and subcategory
- 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
- Need to echo category id in multi-dimensional array
- Getting Category Children
- More efficient way to list posts by category [duplicate]
- Template for product-category page [closed]
- Showing HTML if Post is In Certain Taxonomy Term
- Exclude categories by ID
- Using in ‘category_name’ in ‘$query->set();’?
- How to store category and tags separatly on wordpress?
- Category view with contents of [gallery]s shown
- Post to inherit custom category background image from parent
- wp_delete_term or wp_delete_category?
- Update custom category fields front-end
- How to add image for all posts associated to specified category?
- Combining these queries? (Same taxonomy term + same category as post)
- WooCommerce shared categories
- WP-CLI Add category as menu item main-menu
- displaying the last product comment in the woocommerce category
- Displaying Single Product Page Parent and Child Category
- Add properties to term object
- get_object_term_cache duplicate terms after update to wordpress 6
- Woocommerce only display child category when parent is checked (on add new product page)
- How to display WooCommerce category image in my category page banner as a background?
- category description not showing in my woocommerce
- List taxonomy terms assigned to a post in hierarchical view
- Conditional label Woocommerce archive [unsolved]
- Sort categories by custom field in WordPress admin
- Show audio player only in specific post type category
- How to get immediate children of a ‘term’ parent id through ‘get_terms’?
- How to show given products only using product id array from specific category page in woocommerce
- Ordering terms whilst in loop
- Shop Category Pages missing s
- How to set acf color field as background color to product category
- How to target all woocommerce categories that don’t have any subcategories in them?
- How to display categories image in loop homepage WordPress
- WooCommerce REST API not returning the default products category
- In if…else condition, the else statement shows even if if statement is correct
- How to show WooCommerce Categories on ‘shop’ page instead of products?
- Show the parent taxonomy by creating shortcode in woocommerce?
- Replace deprecated get_category_children code with get_terms
- Can’t display posts by filtering categories using isotope.js
- How can I display all products from all categories on one page with woocommerce?
- How to add all subcategories as submenu in WordPress menu
- How to edit woocommerce sub-category page
- When creating a new product, auto assign it to all custom taxonomy woocommerce
- How to remove parent category from child category url using wordpress rewrite rule?
- Get categories within specific term
- 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
- selecting categories that have products with tag/category
- Change background image page header overlay for each category
- List non-empty categories from a custom post type
- 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