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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)