Codexshaper / laravel-woocommerce

WooCommerce Rest API for Laravel
MIT License
198 stars 57 forks source link

Undefined array key "X-WP-Total" #92

Closed saqlainkhadim closed 2 years ago

saqlainkhadim commented 2 years ago

I am getting this error Undefined array key "X-WP-Total" $result=Order::paginate(20); return view('website_orders.index', compact('result')); Does anyone knows please help

daniel-de-wit commented 2 years ago

I had the same problem and noticed that the WooCommerce API returned the headers all lowercase.

Fortunately you can configure these within the config/woocommerce.php file, like this:

'header_total' => env('WOOCOMMERCE_WP_HEADER_TOTAL', 'x-wp-total'),
'header_total_pages' => env('WOOCOMMERCE_WP_HEADER_TOTAL_PAGES', 'x-wp-totalpages'),

Or just add/update the .env variables, like this:

WOOCOMMERCE_WP_HEADER_TOTAL=x-wp-total
WOOCOMMERCE_WP_HEADER_TOTAL_PAGES=x-wp-totalpages
saqlainkhadim commented 2 years ago

Hello @daniel-de-wit , i have another issue related to woocommerce. some times When I update the product stock from laravel application to woocomerce application using codexshaper/laravel-woocommerce it gives this Error: cURL Error: getaddrinfo() thread failed to start {"exception":"[object] (Exception(code: 1): cURL Error: getaddrinfo() thread failed to start at /home3/revebe57/public_html/carlanisa.revebe.com/vendor/codexshaper/laravel-woocommerce/src/Traits/WooCommerceTrait.php:83)

i don't know how to solve it. if anyone have idea about then please tell me.

daniel-de-wit commented 2 years ago

@saqlainkhadimbusiness I'm not sure that is an issue with this package, but I could be mistaken.

I can't help you with this issue. Good luck

alexszilagyi commented 1 year ago

@saqlainkhadim : I can confirm that I am getting the same error on my end. I am trying to solve it. I'll post my solution here or maybe contribute to this repo.