Get woocommerce product price by id [closed]

You can create a product object using the following function:

$product = wc_get_product( $post_id );

And after that you will be able to access to all product’s data. All available methods can be found here, but the ones you need are:

$product->get_regular_price();
$product->get_sale_price();
$product->get_price();

Leave a Comment