Home > OS >  Cant seem to get the Pagination to work on my WooCommerce REST API application?
Cant seem to get the Pagination to work on my WooCommerce REST API application?

Time:04-12

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:

CodePudding user response:

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

  • Related