0

I have been working and testing the woocommerce/wc-api-node with my local website for days now, still unable to figure out what is wrong with it?

const WooCommerce = new WooCommerceAPI({
  url: 'http://localhost:8080',
  consumerKey: 'ck_2617',
  consumerSecret: 'cs_7f51'
   })

export class CreateCoupon{
static createCoupon( ){

const data = {
 code: '10off',
 discount_type: 'percent',
 amount: '10',
 individual_use: true,
 exclude_sale_items: true,
 minimum_amount: '100.00'
}
 //i did try to add this as well coupons?_method=post
 WooCommerce.post('coupons', data, function(err, data, res) {
 console.log(res);
 console.log(err);
   });
  }
 }
 //error {"errors":[{"code":"woocommerce_api_missing_coupon_data","message":"No coupon data specified to create coupon"}]}

Another setting with latest WordPress, admin login, all set looks good, i am able to get products, but not post :( .

thanks

Jerry H
  • 135
  • 1
  • 2
  • 10