Site icon Hip-Hop Website Design and Development

How to use operator and && for show "something" [migrated]

I have code to display "Hello World" based on size attributes.

The code is :

add_action( 'woocommerce_before_main_content','show_something', 5 );
function show_something() {
  if (is_tax('pa_size')) {
    echo "<h2>Hello World</h2>";
    }
}

The code above it’s worked.

But what i want actually is add an additional one condition that is a color attribute that has a red value/term in addition to size attributes for displaying "Hello World"

What I have tried is:

add_action( 'woocommerce_before_main_content','show_something', 5 );
function show_something() {
  if (is_tax('pa_size') && is_tax(array('pa_color','red'))) {
    echo "<h2>Hello World</h2>";
    }
}

But it didn’t work.

Can anyone take a minute to help me fix this code please?

Any help is greatly appreciated,
thank you