Woocommerce – how to tell if product post has variations or not
Use $product->is_type() function to check the product type. To check if the product is a variable product use: global $product; // $product->is_type( $type ) checks the product type, string/array $type ( ‘simple’, ‘grouped’, ‘variable’, ‘external’ ), returns boolean if ( $product->is_type( ‘variable’ ) ) {} There is also $product->get_type() function that returns the internal type … Read more