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

List of products by category? #224

Open eros2187 opened 7 years ago

eros2187 commented 7 years ago

Good morning I would like to know how it is possible to have a list of products by category I'm using this class but I will not return the products but arary only of the parameters of the category how can i do thanks !!

$category_id="16"; print_r( $client->products->get_categories( $category_id ) );

qroft commented 6 years ago

Have you found a solution for this? I have checked the global get() result and thus i came to this idea, but it does not work either: print_r( $client->products->get( array( 'categories' => 'Shirts' ) ) );

But i am sure that it has to be something into that direction.

qroft commented 6 years ago

Ok, it looks like i found it out. It seems that it has to be like this: $category_name = "shirts"; print_r( $client->products->get(null,array('filter[category]'=>$category_name)) );

radwaali commented 6 years ago

@qroft answer is the one you need

soheilsalimidev commented 6 years ago

hi, I want to know it possible to have a list of products by tag??