Permita pedidos pendientes y notifique al cliente sobre las categorías de productos principales en Woocommerce

Con woocommerce, utilicé un código basado en mi hilo anterior:
Permitir pedidos pendientes y notificar al cliente sobre categorías específicas de productos en Woocommerce

add_filter( 'woocommerce_product_is_in_stock', 'filter_product_is_in_stock', 10, 2 );
function filter_product_is_in_stock( $is_in_stock, $product ){
    // Here set the products categories in the array (can be terms ids, slugs or names)
    $categories = array("clothing");

    if( has_term( $categories, 'product_cat', $product->get_id() ) ){
        $is_in_stock = true;
    }
    return $is_in_stock;
}

add_filter( 'woocommerce_product_backorders_allowed', 'filter_products_backorders_allowed', 10, 3 );
function filter_products_backorders_allowed( $backorder_allowed, $product_id, $product ){
    // Here set the products categories in the array (can be terms ids, slugs or names)
    $categories = array("clothing");

    if( has_term( $categories, 'product_cat', $product_id ) ){
        $backorder_allowed = true;
    }
    return $backorder_allowed;
}

add_filter( 'woocommerce_product_backorders_require_notification', 'filter_product_backorders_require_notification', 10, 2 );
function filter_product_backorders_require_notification( $notify, $product ){
    // Here set the products categories in the array (can be terms ids, slugs or names)
    $categories = array("clothing");

    if( has_term( $categories, 'product_cat', $product->get_id() ) ){
        $notify = true;
    }
    return $notify;
}

Pero parece que no funciona cuando utilicé las categorías de productos raíz.

¿Cómo puedo obtener las categorías de productos raíz en las declaraciones if del código?

Respuestas a la pregunta(1)

Su respuesta a la pregunta