laravel-woocommerce
laravel-woocommerce copied to clipboard
Total Products
Hi,
How receives the total of products ? (curl https://example.com/wc-api/v3/products/count )
Thanks
Hello @piloufaces
Thanks for your comment. I think wc-api/v3/products/count isn't a valid endpoint for the latest rest-api version. Please follow the latest official http://woocommerce.github.io/woocommerce-rest-api-docs doc.
Don't worry you can do it by this package. You can do it in two ways
The first one direct call count method.
$totalResult = Product::count();
The second one using the WooCommerce Facade. In this way, you must request an endpoint.
$products = Product::all();
$totalResults = WooCommerce::countResults()
Note: Make sure the package version is 2.4 or greater. Always use the latest version.
Best regards, Md Abu Ahsan Basir