Site icon Qaisar Satti's Blogs

WooCommerce get product tax information

WooCommerce get product tax information

Today we talk about how WooCommerce get product tax information? In our example, we will get product tax information like status, and tax class. So let’s start with our example.

If you want to load product information by it id then use the following code.

$p_id = 20;
$product_info = wc_get_product( $p_id );

Now you have product object. You can get tax infromation with the following code.

$product_info->get_tax_status(); // get product tax status
$product_info->get_tax_class(); // get product tax class
Exit mobile version