How to get WooCommerce products grouped by their categories?

In this tutorial we’ll learn how to get all woocommerce products grouped by their categories. Here is the lines of code which can achieve that: <?php $args = array( ‘number’ => $number, ‘orderby’ => ‘title’, ‘order’ => ‘ASC’, ‘hide_empty’ => $hide_empty, ‘include’ => $ids ); $product_categories = get_terms( ‘product_cat’, $args ); $count = count($product_categories); if …

How to get WooCommerce products grouped by their categories? Read More »