pixelpeter / laravel5-woocommerce-api-client

Laravel 5 wrapper for the Woocommerce REST API
MIT License
126 stars 48 forks source link

Undefined index: X-WP-TotalPages #59

Open ghost opened 4 years ago

ghost commented 4 years ago

Hi friends. I want to fetch all orders and put them in array but this code returns : Undefined index: X-WP-TotalPages

$params = [
           'per_page' => 100,
           'page' => 1
        ];

        $woocommerceorder = Woocommerce::get('orders', $params);
        while (Woocommerce::hasNextPage()) {
                 $params = [
                    'per_page' => 100,
                    'page' => Woocommerce::nextPage()
                 ];
                 $woocommerceorderpart = Woocommerce::get('orders', $params);
                 $woocommerceorder = array_merge($woocommerceorder, $woocommerceorderpart);
        }

any idea ?

stromgren commented 4 years ago

See my pull request #57 for a fix for this issue.