get product by product id woocommerce code example
Example 1: woocommerce get product id
global $product;
$product->get_id();
Example 2: get stock product woocommerce by id
$product_id = 1100;
$product = wc_get_product($product_id);
echo $product->get_stock_quantity();
Example 3: is product category woocommerce
if( has_term( 4, 'product_cat' ) ) {
// do something if current product in the loop is in product category with ID 4
}