How can I show “sold out” instead of “out of stock” for some products with particular tags and categories [closed]

Try this

add_filter( 'woocommerce_get_availability', 'change_out_of_stock_text_woocommerce', 1, 2);

function change_out_of_stock_text_woocommerce( $availability, $product_to_check ) {
    
   
    if ( ! $product_to_check->is_in_stock() || has_term( 'my-ex-cat-slug', 'product_cat' ) || has_term( 'my-ex-tag-slug', 'product_tag' )) {
        
        $availability['availability'] = __('Sold Out', 'woocommerce');
        
    }
    return $availability;
}

Change my-ex-cat-slug with your Category’s slug and my-ex-tag-slug with tag’s slug