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
- Display All Products by Category with WooCommerce
- get_terms vs. get_categories: does it matter?
- Fixing category count
- Elegant way to add parent categories?
- Reflect nested categories in appearance > menus
- Are Categories, Tags and Custom Taxonomies any different in regards to SEO?
- Excluding posts from a category but only if they’re not in multiple categories
- Update term count using a callback function
- Does WordPress Offer a Way to Find All of the Categories that Don’t Have Children?
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- Display WooCommerce product categories in a 4 columns custom menu [closed]
- Getting the sub category
- How to select product category while adding new product in woocommerce? [closed]
- display woocommerce all category title on home page
- When to use ‘get_category_by_path’ vs. ‘get_term_by’ to get category object from `get_query_var( ‘category_name’ )`?
- Add Product categories to WordPress menu without losing hierarchy
- Display “add to cart” button on every listing in product category page?
- Custom page for WooCommerce’s /product-category/
- Getting categories id for all products in cart
- get_cat_ID() not wokring
- Display child categories in WooCommerce
- WooCommerce duplicate sub categories and product slugs
- WooCommerce IF statements not working
- Woocommerce category show subcategories only/omit posts for specific category
- products nested by subcategories in a current category archive
- WC 3.x Get categories from variable product of the cart
- Limit number of terms that a custom taxonomy can save per custom post type
- Link Attachment Image to Category
- How can i insert term in a specific language of Polylang?
- Hide woocommerce category name from specific pages
- Pagination not visible on woocommerce’s category page
- Remove product category placeholder image (Woocomerce)
- Unwanted Duplicate Product Categories in WooCommerce
- Woocommerce custom category pages
- Customize WordPress widget – Product Category
- WooCommerce – How to show specific category first-rest of products-specific category last
- Is There a Difference Between Taxonomies and Categories?
- Getting category URL with hyphens, not spaces
- get_terms function not returning anything
- Categories are not listing their respective products
- Include WooCommerce product to all child categories
- Get Categories Where Taxonomy Equals ‘n’
- How to Link to Most Recent Custom Post of Same Term
- Display all product tags associated with a specific product category
- How to access deleted term inside delete_product_cat action
- Apply WordPress function on specific woocommerce product categories only
- Adding custom ID field to the categories
- How to display product with two condition, category and brand taxonomy
- Show different menu on each woocommerce category page
- Getting Category Children
- Showing HTML if Post is In Certain Taxonomy Term
- Category view with contents of [gallery]s shown
- How to add image for all posts associated to specified category?
- Add properties to term object
- category description not showing in my woocommerce
- List taxonomy terms assigned to a post in hierarchical view
- Sort categories by custom field in WordPress admin
- How to get immediate children of a ‘term’ parent id through ‘get_terms’?
- 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
- Show the parent taxonomy by creating shortcode in woocommerce?
- How to add all subcategories as submenu in WordPress menu
- in post content shortcode works, but hardcoded in same page template doesn’t?
- 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 to delete WooCommerce categories in bulk that only have one product
- Product Category page showing all products
- How to load terms of a custom taxonomy of a product in woocommerce cart page
- product_cat image url from database
- Add subcategories posts to the counts column at the admin’s categories list
- Get category of a taxonomy for a queries object in a loop
- WordPress using get_term to retreive slug not working as expected
- Display List of Categories Within a Custom Taxonomy
- List Terms by category
- Display one post on category.php: Wrong featured image
- How to add a new child category via an SQL statement?
- Why is my post categories not displaying?
- Problem importing categories and sub-categories
- Use get variable when rewritten url in wordpress
- Custom Woocommerce Category view
- Displaying categories and subcategories without link
- Sorting Woocommerce products by category and attributes
- How to get Woocomerce categories count
- Woocommerce – Display product category of product in Orders page
- Changing Woocommerce categories programatically
- how do i set an image for a category in admin panel
- Issue on Listing Sub Product Categories In Woocommerce
- How to link images of one WP site to another WP site?
- Categories and products woocommerce wordpress
- List the category tree of all the product_cat categories
- Restricted category in Woocommerce [closed]