Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Regular Product Price with Tax

I'm trying to get the regular product price with tax included but I cannot find any WooCommerce function or variable with this purpose.

To get the regular product price without tax I'm using:

$price = $product->get_regular_price();

But how can I get the regular product price WITH tax included?

like image 220
Carol-Theodor Pelu Avatar asked Sep 05 '25 22:09

Carol-Theodor Pelu


2 Answers

wc_get_price_including_tax( $product, array('price' => $price ) );
wc_get_price_including_tax( $product, array('price' => $specialPrice ) );

LE: You need to add the price as the second argument to wc_get_price_including_tax()

like image 177
bratucornel Avatar answered Sep 10 '25 22:09

bratucornel


Here is the code -

product price with tax - wc_get_price_including_tax($product);

product price without tax - wc_get_price_excluding_tax($product);

like image 35
Alice Avatar answered Sep 11 '25 00:09

Alice