WP_Query wooCommerce category

You can try the following code to check whether a category with a name exist of not

$search_category_name="T-shirts";
//This gets top layer terms only.  This is done by setting parent to 0.  
    $parent_terms = get_terms('product_cat', array('orderby' => 'slug', 'hide_empty' => false));

    foreach ($parent_terms as $pterm) {
        //check whether the category_name exists
        if ($search_category_name == $pterm->name) {
            return true;
        }           
    }

And for creating a new one you can refer to this link