Today we talk about how WooCommerce get product stock information? In our example, we will get product stock information like stock status, manage stock, and stock quantity. So let’s start with our example.
If you want to load product information by it id then use the following code.
$product_info = wc_get_product( $p_id );
Now you have product object. You can get stock infromation with the following code.
$product->get_stock_quantity(); // get product stock quantity
$product->get_stock_status(); // get stock status