'Cant seem to get the Pagination to work on my WooCommerce REST API application?

What I got so far:

        [
            'wp_api' => true,
            'version' => 'wc/v3',
            'query_string_auth' => true //Force Basic Authentication as query string true and using under HTTPS
            
        ]
    );
        

try {
    $results = $woocommerce->get('orders?per_page=30');
    $result = count($results);

I tried to remove the query_string_auth but I dont get any data displayed. FYI it works without the page=30 but then only displayed the first 10 items.

Any advice would help alot:



Solution 1:[1]

Get method accepts extra parameters.

$woocommerce->get($endpoint, $parameters = []);

Try like this

$woocommerce->get('orders', array('per_page' => 30));

More details can be seen here

Solution 2:[2]

If you are using Nginx, check your Nginx configurations. Missing Nginx settings will ignore the GET method query parameters. So it might be the issue that your page or per_page parameter are simply being ignored.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mujuonly
Solution 2 zawhtut