Davy
Davy

Reputation: 11

WooCommerce variable price to show default value

I need to show in my store the price set for each varying product by default. It currently shows me the highest price of product variations and I can't find a way to change it.

I have high price there and this code in loop start page:

<h5 class="network-price"><?php echo get_field('network_price_text',$p_id); ?> <?php echo $currency;  echo $variation_product->regular_price; ?>pm</h5>
<h5 class="our-price"><?php echo get_field('our_price_text',$p_id); ?> : <?php echo $currency; echo $variation_product->sale_price; ?>pm</h5>

Would you be able to help me with solution?

Upvotes: 0

Views: 358

Answers (1)

Areeb Saeed Raja
Areeb Saeed Raja

Reputation: 74

For that, you need to select the basic product variation, like you have three prices like 20$, 30$ and 40$. Then select the basic variation product it helps to show your least amount of the product.

Also, here is some helpful code:

$variation_min_price = $product->get_variation_price();

Upvotes: 1

Related Questions