WooCommerce-REST-API-Client-Library icon indicating copy to clipboard operation
WooCommerce-REST-API-Client-Library copied to clipboard

Return 10 porducts

Open soheilsalimidev opened this issue 6 years ago • 2 comments

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??

soheilsalimidev avatar Aug 31 '18 19:08 soheilsalimidev

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

kornellvarga avatar May 08 '22 11:05 kornellvarga

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

kornellvarga avatar May 08 '22 11:05 kornellvarga