Merge an array into a predefined one. Convenient to handle default configurations.
wp_parse_args( string|array|object $args, array $defaults = array() ): array
$args = wp_parse_args(
array(
'relation' => 'AND',
array(
'taxonomy' => 'product_type',
'field' => 'slug',
'terms' => 'variable',
'operator' => 'IN'
),
),
$query->get( 'tax_query' )
);
$query->set( 'tax_query', $args );
Source: https://developer.wordpress.org/reference/functions/wp_parse_args/