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

Variations not working

Open bedoya opened this issue 8 years ago • 0 comments

Maybe this library is a little too old, but I was looking for one exactly like this. Sadly it does not have support for variations. I tried creating the method to create a variation, adding the following code to the /lib/woocommerce-api/resources/class-wc-api-client-resource-products.php

public function create_variation( $id, $data ) {
	$this->set_request_args( array(
		'method' => 'POST',
		'body'   => $data,
		'path'   => $id . '/variations',
	) );
	return $this->do_request();
}

I made sure the product with ID $id exists, but I keep getting a message about the URL is not working, the localhost URL is:

POST: http://localhost/wordpress/wc-api/v2/products/$id/variations

bedoya avatar Oct 21 '17 06:10 bedoya