I'm working with WooCommerce api v3, and when I call
$woocommerce->get('products/categories');
It returns only 10 results. I read the documentation and there is no specification about how to list all categories from api, but I have more than 40 categories on wordpress.
Someone already had this problem before?
Thanks!
you can pass more parameters to the function as you can see in the documentation. This should work:
$woocommerce->get('products/categories', array( 'per_page' => -1 ) );
Looks like -1 doesn't work to display all the categories, so a positive integer needs to be in place instead.
$woocommerce->get('products/categories', array( 'per_page' => 99 ) );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With