Woocommerce - Display Lowest Price on Category (Archive) Page Only
<p>I'm trying to display the lowest price instead of the price range on the category pages while continuing to display the price range on the individual product pages. </p>

<p>I found this answer from someone else's question:</p>

<pre><code>add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2);

function custom_variation_price( $price, $product ) {

    $price = '';

    if ( !$product-&gt;min_variation_price || $product-&gt;min_variation_price !== $product-&gt;max_variation_price ) {
        $price .= '&lt;span class="from"&gt;' . _x('From', 'min_price', 'woocommerce') . ' &lt;/span&gt;';
        $price .= woocommerce_price($product-&gt;get_price());
    }

    return $price;
}
</code></pre>

<p>And it works, but when I put the code in <code>functions.php</code>, it applies to the whole site. I only want it to apply to the category pages. </p>

<p>Also, when I use this code, items with only one price end up with no price being displayed. </p>

<p>What can I do?</p>

<p>Here's a screenshot of what I mean:
<a href="http://i.stack.imgur.com/da4cV.png" rel="nofollow">Screenshot of current category page</a></p>