I have managed to get all parent categories from Woocommerce with this function
$terms = get_terms( array( 'taxonomy' => 'product_cat', 'hide_empty' => false, 'parent' => 0 ) );
But I haven't managed to do the same with WP_Query. Now I have 2 questions:
- How can I do the same - getting a list of categories from Woocommerce - with WQ_Query
- Is it recommended to use WP_Query over get_terms?