Closed sethsnel closed 4 years ago
Hi @sethsnel,
Thank you for reporting the issue!
I am moving it to the WC REST API repository so it could be properly looked at there.
Thanks for the response and moving the ticket to the appropriate section. I wasn't aware ;)
@sethsnel,
I have 228 products on my test site where I tried to replicate the issue you are having. I managed to successfully retrieve the last 28 products using https://mysite.mystagingwebsite.com/wp-json/wc/v3/products?page=3&per_page=100
GET request:
I recommend trying the same with all plugins deactivated but WooCommerce to see if it makes any difference.
I don't have control over the woocommerce installation and therefore cannot easily disable plugins.
You can create a staging site (which is a copy of the live site) using a free plugin called WP Staging and test there without worrying to break the live site.
Hi @sethsnel,
As a part of this repository’s maintenance, I am closing this issue due to inactivity. Please feel free to comment on it in case we missed something. We’d be happy to take another look.
@juliaamosova thanks for testing to reproduce the error using my steps. My apologies for not responding. I totally agree with you that there's likely a problem with the server this Woocommerce installation is installed on and/or plugins that are installed along.
However, unfortunately I don't have acces to the our clients server and/or Woocommerce installation. We just have access to read data from their API. I have retried fetching products with per_page count of 100 and it still failing. We solved this with a hardcoded exception for this domain, were we set per_page = 75 for this specific domain/client.
So this solves the issue for our use case (fetching all product information), but might still prove to be a vulnerability to the Woocommerce API. Perhaps other people experiencing the same might find this issue and reply with their environment.
Thanks again for your assistance.
Bug description When setting per_page to 100 or 99 on the GET products api call, we are retrieving an empty body response on the last page. However when per_page is set to 50 or 75 it works as expected. Because of this issue we cannot reliable retrieve the largest amounts of products per page.
Also interesting to note, in both instances the second to last page gives a "prev" and "next" link in their response header. And on the last page only a "prev" link. (like expected)
To Reproduce Here are sample requests we make: Succesfull with per_page=50: https://pastebin.com/4NWc3UJV Unsuccesfull with per_page=100: https://pastebin.com/yWVfazTv
Expected behavior Retrieve the remaining 93 products on the last page when per_page count is set to 100 (and page= 3)
Isolating the problem:
WordPress Environment