Codexshaper / laravel-woocommerce

WooCommerce Rest API for Laravel
MIT License
189 stars 59 forks source link

Product::all() not giving all the products. [URGENT] #68

Closed faizan-glowlogix closed 3 years ago

faizan-glowlogix commented 3 years ago

Hi,

I need all the products that are in my woocomerence website. when i write

$products = Product::all()

if gives me on 10 lastest products i need all products in my existing system..

faizan-glowlogix commented 3 years ago

How can i add give page number here? anyone share any solution?

maab16 commented 3 years ago

Hello @faizan-glowlogix,

Thanks for creating the issue but it's not an issue. You can read woocommerce official documentation before use this package. I don't have enough to enhance it. I'll try to some more features when I get time. Please follow this link https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-products.

use Product;

$options = [
    'per_page' => 50, // By default 10
    'page' => 2 // This is will return 51 to 100 products. By default 1 that returns the 1 to 50 for this example because we add per_page 50
];

$products = Product::all($options);
faizan-glowlogix commented 3 years ago

@maab16 yes thanks I have reviewed that and worked accordingly