How do I create a category?
I've been banging my head. I've managed to extend the class to GET categories (which was super easy). It doesn't work with POST at all. It gives me a
Error: No route was found matching the URL and request method [woocommerce_api_no_route] 404
Here is the get_categories working:
public function get_categories( $id = null, $args = array() ) {
$this->set_request_args( array(
'method' => 'GET',
'path' => array( 'categories', $id ),
'params' => $args,
) );
return $this->do_request();
}
Tried the POST method and it doesn't work:
public function create_categories($data) {
$this->set_request_args( array(
'method' => 'POST',
'path' => 'categories',
'body' => $data
) );
return $this->do_request();
}
I've checked woocomerce API documentation and looks as if the syntax is correct...
Here is the url in the error: http://www.mysite.com/wc-api/v2/products/categories?oauth_consumer_key etc... The json error returned shows that method is "POST" too..
Any help would be appreciated! Thanks!
Answering my own question. IT doesn't work with this version of woocommerce API. Please update this really great tool to work with the new woocommerce api (https://woothemes.github.io/woocommerce-rest-api-docs/) instead of (https://woothemes.github.io/woocommerce-rest-api-docs/v2.html)