Closed Draidel closed 4 years ago
Hello @Draidel
Thanks for creating an issue. By default woocommerce rest api returns 10 results for per page. Read this doc https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-products
If you want to get more or less products for per page then you can pass per_page
option in all
method.
$products = Product::all(['per_page' => 15]);
By default page
number is 1. If you want to fetch next page or specific page data you can pass page
option.
$products = Product::all(['page' => 2, 'per_page' => 15]);
If you want to fetch products with pagination use below code
$per_page = 15;
$page_number = 2;
$products = Product::paginate($per_page, $page_number);
It will returns 15 products and pagination information (Total records, total pages, current page, previous page, next pages, first page, last page).
Hope your issue solved. Enjoy.
Regards, Md Abu Ahsan Basir
Hope you are enjoying it. If you like this package and want to support contributors then just press the star button. They will encourage to provide great features. Thanks
@Draidel I had the problem today. I took hours to find the problem out.
Find the woocommerce class, called something like: woocommrece restapi crud controller. Find the line where maximum is 100 and change to billions
Exception
Error: Invalid parameter(s): per_page [rest_invalid_param]
@Codexshaper
Hi, I am doing this:
$products = Product::all();
and I just get an array with 10 results, why? (I have thousands of products)