kloon / WooCommerce-REST-API-Client-Library

A PHP wrapper for the WooCommerce REST API
GNU General Public License v3.0
356 stars 175 forks source link

Return 10 porducts #252

Open soheilsalimidev opened 6 years ago

soheilsalimidev commented 6 years ago

I use this code to get 20 products but it doesn't working $client->products->get(array( 'filter[limit]' => 20 )) what i shoud to do??

kornellvarga commented 2 years ago

Hi, I am having the same issue, have you solved this?

kornellvarga commented 2 years ago

I think I have just found the solution... well at least for my purpose this is working!

        echo json_encode(
            $client->products->get(
                null,
                array( 
                    'filter[limit]' => -1
                ),
            )
        );

This means that the php returns a JSON of all products with all details, I think that you have to specify that the path is null to make it search through all and then -1 for the limit if you want all to be listed, or any number you want.. I know.. 4 years too late with this answer :D