I am trying to get the "Uncategorized" default WooCommerce plugin category id.
I would say that since it is the first category that is created by default, the id would be 1, term_id = 1, but it is not the case.
I also tried:
$args = array(
'taxonomy' => 'product_cat',
'hide_empty' => false,
'parent' => 0, // to get only parent terms
'fields' => 'id=>name',
);
$terms = get_terms( $args );
But it returns all terms. I need only the ID (term_id) of the "Uncategorized" default Category create by WooCommerce upon activation.
Is there a function like get_default_cat_id() or similar? I cannot use 'name__like' => 'Uncategorized' because the name 'Uncategorized' could be changed to something else.
It's saved as an option under the name default_product_cat. To get the ID you can call get_option()
$uncategorized_term_id = get_option( 'default_product_cat' );