Help with PHP Programming in WooCommerce/WordPress


#1

I have a quick question regarding WooCommerce Dynamic Pricing functionality. I want to show a specific price of a product throughout the site with two options. How can I retrieve two prices values?

Thanks in Advance.


#2

Hi,

You just need to add below code in your function.php file.

function so_28073705( $product_id ) {

$wc_product_variable  =  new WC_Product_Variable( $product_id );

$variation_price_html  =  $wc_product_variable->get_price_html( );

return $variation_price_html;

}

After adding this code anywhere in function.php you will see your issue resolved. If not feel free to consult the source link.

Source: https://www.fmeaddons.com/blog/5-programming-questions-and-their-answers-on-woocommerce-dynamic-pricing-extension/