I have created the code to loop through the product list and display the price
$args = array( 'post_type' => 'product', 'posts_per_page' => 100, 'product_cat' => 'hot-deals');
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
global $product;
$xml .= '<Original_price>' . $product->get_display_price( $product->get_regular_price() ) . '</Original_price>';
$xml .= '<Discount_price>' . $product->get_display_price() . '</Discount_price>';
echo $product->get_price_html();
endwhile;
wp_reset_query();
get_price_html()
works perfectly and display the price like this:
From: $ 621 $ 559
However , I would like to get the price separately
I can get the sales price with
$product->get_display_price()
The problem is, I can not get the original price,
I tried $product->get_regular_price()
, that return nothing
And I tried $product->get_display_price( $product->get_regular_price() )
, that return the sales price
So how to get the original price ? Thanks a lot.