0
votes

In Woo-commerce the default shop page can be set to show the products by their categories. When doing so it lists their thumbnail/title/link/how many products are available.

It does not however show price.

The goal is to list out the product categories and list the starting price of their products. For example: Category-1 starts at $9.99 (category-1 cheapest products is 9.99)

Tips/tricks/ideas would all be appreciated

Below is the default template that is used for that page:

<?php
/**
 * The template for displaying product category thumbnails within loops.
 * Override this template by copying it to yourtheme/woocommerce/content-product_cat.php
 */

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

global $woocommerce_loop;

// Store loop count we're currently on
if ( empty( $woocommerce_loop['loop'] ) )
    $woocommerce_loop['loop'] = 0;

// Store column count for displaying the grid
if ( empty( $woocommerce_loop['columns'] ) )
    $woocommerce_loop['columns'] = apply_filters( 'loop_shop_columns', 4 );

// Increase loop count
$woocommerce_loop['loop']++;
?>
<li class="product-category product<?php
    if ( ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] == 0 || $woocommerce_loop['columns'] == 1 )
        echo ' first';
    if ( $woocommerce_loop['loop'] % $woocommerce_loop['columns'] == 0 )
        echo ' last';
    ?>">

    <?php do_action( 'woocommerce_before_subcategory', $category ); ?>

    <a href="<?php echo get_term_link( $category->slug, 'product_cat' ); ?>">

        <?php
            /**
             * woocommerce_before_subcategory_title hook
             *
             * @hooked woocommerce_subcategory_thumbnail - 10
             */
            do_action( 'woocommerce_before_subcategory_title', $category );
        ?>

        <h3>
            <?php
                echo $category->name;

                if ( $category->count > 0 )
                    echo apply_filters( 'woocommerce_subcategory_count_html', ' <mark class="count">(' . $category->count . ')</mark>', $category );
            ?>
        </h3>

        <?php
            /**
             * woocommerce_after_subcategory_title hook
             */
            do_action( 'woocommerce_after_subcategory_title', $category );
        ?>

    </a>

    <?php do_action( 'woocommerce_after_subcategory', $category ); ?>

</li>
1

1 Answers

0
votes