• I am trying to get the top 4 most popular categories, meaning the categories returned should have the most sales? What arguments do i have to change in my WP_Query?

    Here is my WP_Query, this returns the best selling products but i want best selling categories.

    $args = array( 'post_type' => 'product', 'per_page' => '24','posts_per_page' => '18','meta_key' => 'total_sales','orderby' => 'meta_value_num');
    $args['meta_query'] = $woocommerce->query->get_meta_query();
    
    $loop = new WP_Query( $args );

    How do i solve this?

    https://www.ads-software.com/plugins/woocommerce/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Best Selling Categories with woocommerce’ is closed to new replies.