WooCommerce - excelling eCommerce
Woocommerce Sorting does not work - Results are always the same (2 posts)

  1. ewdrobert
    Posted 2 years ago #

    I am developing a custom theme and I am trying to sort the products as per the selection made by the use of the dropdown menu. Although the page reloads after the selection is made, the results are not sorted out, regardless of the option chosen. The results are always the same. Can anyone please help sort the products correctly as per the option chosen via the dropdown menu? I am using do_action('woocommerce_before_shop_loop'); to show the sort options.

    Here's the actual code in index.php

        $args = array(
            'post_type' => 'product',
            'orderby' => $_GET['orderby'],
        $wp_query = new WP_Query($args);
        <?php do_action('woocommerce_before_shop_loop'); ?>
        <ul class="products_list">
            <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
                <?php woocommerce_get_template_part('content', 'product'); ?>
                <?php endwhile;


  2. Mr.Antonio
    Posted 1 year ago #

    I have this problem, have you find solution?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic