Display a list of Categories and show the price range of their products
-
Hi,
I am trying to create a list of categories and the price range of the products within those categories.
E.g
Headwear – £30-£150
Shoes – £35-£300etc.
Currently, I have been able to successfully display the categories, but am stuck on how to now pull and display the prices at the same time.
I’m fairly new to WC so any help would be greatly appreciated, especially if there is a built in way of doing this.
Here is the code so far for pulling and displaying the categories
<?php // Taxonomy for product categories $taxonomy = 'product_cat'; // Get parent product categories $parent_product_cats = get_terms( $taxonomy, array( 'parent' => 0, 'orderby' => 'slug', 'hide_empty' => false ) ); if( !empty($parent_product_cats) ){ echo ' <ul>'; foreach ($parent_product_cats as $key => $category) { echo ' <li>'; echo '<a href="'.get_term_link($category).'" >'; echo $category->name; echo '</a>'; echo '</li>'; } echo '</ul> '; }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Display a list of Categories and show the price range of their products’ is closed to new replies.