Add Child Terms for Woocommerce Product Attribute

// Child Terms for Woocommerce Product Attribute
// For Sub Terms.. like Color Shades ...

if( function_exists( 'WC' ) ){
    add_action( 'init', 'yith_woocommerce_register_taxonomies_hack', 4 );

    if( ! function_exists( 'yith_woocommerce_register_taxonomies_hack' ) ){
        function yith_woocommerce_register_taxonomies_hack(){
            if( $attribute_taxonomies = wc_get_attribute_taxonomies() ) {
                foreach ($attribute_taxonomies as $tax) {
                    if ($name = wc_attribute_taxonomy_name($tax->attribute_name)) {
                        add_filter( "woocommerce_taxonomy_args_{$name}", 'yith_woocommerce_taxonomy_product_attribute_args' );
                    }
                }
            }
        }
    }

    if( ! function_exists( 'yith_woocommerce_taxonomy_product_attribute_args' ) ){
        function yith_woocommerce_taxonomy_product_attribute_args( $taxonomy_data ){
            $taxonomy_data['hierarchical'] = true;
            return $taxonomy_data;
        }
    }
}