Display the product price in a WP_Query loop in Woocommerce Display the product price in a WP_Query loop in Woocommerce wordpress wordpress

Display the product price in a WP_Query loop in Woocommerce


August 2020 Update

You should need to replace the line:

<p><?php echo $wc_query->get_price_html(get_the_ID()); ?></p>

By the following lines:

<?php $price = get_post_meta( get_the_ID(), '_price', true ); ?><p><?php echo wc_price( $price ); ?></p>

Or by this much better way (that will output the correct formatted price for display):

<?php $product = wc_get_product( get_the_ID() ); /* get the WC_Product Object */ ?><p><?php echo $product->get_price_html(); ?></p>