How to get single variation regular and sale(if it exists) prices?
-
I need to show product variations in the custom place, with both their regular and sale prices.
I ‘m trying that way, but only one price is showing – sale if it exists, and regular if not.$price = get_post_meta( get_the_ID(), '_regular_price', true); $sale = get_post_meta( get_the_ID(), '_price', true); if (!empty($sale)){ echo $sale; } else { echo $price; }
or like that – it’s whole trash
$min_regular_price = $product->get_variation_regular_price( 'min', true ); $min_sale_price = $product->get_variation_sale_price( 'min', true ); $max_regular_price = $product->get_variation_regular_price( 'max', true ); $max_sale_price = $product->get_variation_sale_price( 'max', true );
It’s very long to explain what I do, maybe all is simle, just I don’t know, or I’ll try to explain if I need to.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to get single variation regular and sale(if it exists) prices?’ is closed to new replies.