When creating a new product, auto assign it to all custom taxonomy woocommerce

For post types not using the block editor, you can use wp_terms_checklist_args filter to manipulate the selected terms of a hierarchical taxonomy. You can use the filter to set pre-selected terms like so,

function auto_check_hierarchial_terms_on_new_post( $args, $post_id ) {
  // is it new post?
  if ( 'auto-draft' !== get_post_status($post_id) ) {
    return $args;
  }
  // is it my taxonomy?
  if ( 'my_custom_taxonomy' !== $args['taxonomy'] ) {
    return $args;
  }
  // let's not overwrite anything by accident
  if ( ! empty( $args['selected_cats'] ) ) {
    return $args;
  }
  // get existing terms
  $terms = get_terms( array(
    'taxonomy' => $args['taxonomy'],
    'hide_empty' => false,
  ) );
  if ( ! $terms || ! is_array( $terms ) ) {
    return $args;
  }
  // pre select all terms
  $args['selected_cats'] = array();
  foreach ($terms as $term) {
    $args['selected_cats'][] = $term->term_id;
  }
  return $args;
}    
add_filter('wp_terms_checklist_args', 'auto_check_hierarchial_terms_on_new_post', 10, 2);

There’s a note on the filter, that it seems to be obsolete for WP 5 block editor.