Viewing 8 replies - 1 through 8 (of 8 total)
  • If you change the theme to storefront does the problem persist?

    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    Yea, check for plugin and theme conflicts: https://docs.woocommerce.com/document/woocommerce-self-service-guide/#section-4. There’s very likely something else involved here causing this.

    Here is the query for the orders on that page: https://github.com/woocommerce/woocommerce/blob/538ee2097c9c9ef7599cd9e634cb033f6c03794b/includes/wc-template-functions.php#L2408. The filter will allow you to add arguments if needed.

    More info: https://github.com/woocommerce/woocommerce/wiki/wc_get_orders-and-WC_Order_Query

    Thread Starter SYNC4489

    (@sync4489)

    Hello everybody,

    I’ve tried to change to Storefront template as advised but the problem persists.
    Anyway I’ve made the following test keeping the storefront template, just to be sure that my template did not override something:

    I’ve added a print_r($customer_orders) to the page orders.php and at the end of the array here’s what I get: [total] => 27 [max_num_pages] => 14 ) 14

    So a total of 27 orders for this customer, that generate 14 pages which corresponds to a (weird) pagination of 2, and I still do not understand where this 2 value comes from… 🙂

    If I add at the beginning of the orders.php the following query:

    $customer_orders = wc_get_orders( apply_filters( 'woocommerce_my_account_my_orders_query', array(
    			'customer' => get_current_user_id(),
    			'paginate' => false,
    		) ) );

    I still get the full array (that I see with print_r) but no loop…
    If I change the paginate parameter to true I get back to square one, which means pages of 2 orders but in this case the orders shown are always the first two, even if the page changes.

    So the real question is: does a parameter for the query woocommerce_my_account_my_orders_query that can change the number of ‘orders per page’ exist?

    Thanks in advance guys for all your help!

    Thread Starter SYNC4489

    (@sync4489)

    Sorry, just a small update..
    I forgot to put the 'page' => $current_page parameter in the query, that was why the orders were not changing if I switched the pages with my query and pagination active.
    But of course the main problem still persists…

    Thread Starter SYNC4489

    (@sync4489)

    Oh I forgot to mention that of course I’ve also disabled all plugins except Woocommerce.
    So, even with Storefront template and all plugins deactivated the problem of the pagination of only 2 orders per page still remains.

    I’ve also tried to update woocommerce to 3.3 but nothing has changed.

    Zandy Ring

    (@zandyring)

    Automattic Happiness Engineer

    Hi SYNC4489,

    When I check the My Orders page in My Account for a test site with only WooCommerce and Storefront active, I see 10 orders per page. It’s very interesting that your site isn’t doing this! Could you send us your System Status Report (WooCommerce > Status)? Also, you might want to try a local hosting site using Flywheel (https://local.getflywheel.com/) just to see if with a totally fresh instance you get the same thing.

    Cheers

    Thread Starter SYNC4489

    (@sync4489)

    Hi Zandy,

    I’ve solved with this snippet:

    add_filter( 'woocommerce_my_account_my_orders_query', 'custom_my_account_orders', 10, 1 );
    
    function custom_my_account_orders( $args ) {
        $args['posts_per_page'] = 15;
        return $args;
    }

    Anyway it’s quite strange. I have this problem only on one website (a big one) even with everything deactivated, no child theme, storefront template.

    But as I said I solved with a little snippet, so not really a problem…

    Cheers

    Zandy Ring

    (@zandyring)

    Automattic Happiness Engineer

    I’m glad you were able to solve it!

    Cheers

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘WC 3.2.6 My Account Orders Pagination’ is closed to new replies.