Reputation: 31
I'm using a Woocommerce REST client API to get products from a Wordpress website. However, when I execute this command:
this->client->products->get();
to get all products, I only have 10 products returned. What might be the problem?
Upvotes: 0
Views: 4748
Reputation: 1237
To retrieve all the products use the limit filter,
To get the 50 products ---- filter[limit]=50
To get all the products --- filter[limit]=-1
No need to change the code etc. only use the limit filter.
Upvotes: 0
Reputation: 637
Setting Blog pages show at most
property is not the solution to this problem. By doing that you're changing behaviour of other pages on your site too. Use following code instead:
$this->client->products->get(null, array('filter[limit]' => -1));
use -1
to get all the products or just use any number to limit it upto that number.
Upvotes: 1
Reputation: 31
I solved it. Nothing to do with the rest client itself. It is wordpress configuration. Just got to settings -> Reading -> and change "Blog pages show at most" or "Syndication feeds show the most recent" to (50) or as you like
Hope it is helping .
Upvotes: 1