Detect Product Type with code
The is_virtual() method in WC_Product class it return boolean. It means that, if $product->is_virtual() return true, it is virtual product, vice versa if return false, then the product is physical. In your case, you can use this if( $product->is_virtual() ) { //is Virtual Product, do something here } if( !$product->is_virtual() ) { //is Physical Product, … Read more