Problem with using Woocommerce api
-
Hello,
I just installed wordpress api by nodejs by following the mentioned steps in node page.
i am using ionic, i created a controller, here is the code i want to use:
.controller(‘AppCtrl’,function($scope){
var WooCommerceAPI = require(‘woocommerce-api’);var WooCommerce = new WooCommerceAPI({
url: ‘http://keloniton.webpi.ir’,
consumerKey: ‘ck_88f6cc253275537a7b874bbfc3a3a8da69f0f3b1’,
consumerSecret: ‘cs_202f523504a6210d4c61e2e6872d4027ab2f7bd5’,
wpAPI: true,
version: ‘wc/v1’
})
Woocommerce.get(‘products/categories’,function(err,data, res){
return JSON.parse(res.toJSON().body);
})
})
But when i run this code i get this error:
ionic.bundle.js:26799 ReferenceError: require is not definedAny idea? any help is really appreciated.
The topic ‘Problem with using Woocommerce api’ is closed to new replies.