get product by category in woocommerce code example
Example 1: woocommerce get product id
global $product;
$product->get_id();
Example 2: 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
}