WooCommerce – Change thank you order notice based on articles in cart (by category)

I need to show a specific notice when there is an article with the product category (product_cat) “media” in the order. I currently just know how to change it for all orders. All my other attempts where not working:

function customize_thankyou_page_notice( $message ) {
  $new_message = 'Your custom message goes here.';
  return $new_message;
}
add_filter( 'woocommerce_thankyou_order_received_text', 'customize_thankyou_page_notice' );