I set up a website to study a store WooCommerce, I activated the api and generated the keys.
In the root of the site I added in the .htaccess, is it in the correct place?:
# Permite acesso ao pacote Font Awesome
<FilesMatch ".(ttf|otf|woff)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
Hereisthecompletetestcode:
import{Component}from'@angular/core';import{NavController}from'ionic-angular';import*asWCfrom'woocommerce-api';@Component({selector:'page-home',templateUrl:'home.html'})exportclassHomePage{WooCommerce:any;products:any[];constructor(publicnavCtrl:NavController){this.WooCommerce=WC({url:"http://wooionic.comajudacoletiva.com.br/",
consumerKey:"ck_899d1c4011cab2bde1f04cd52704c248f155ecdc",
consumerSecret:"cs_cc90feaf8467c0a53679be89f137557cdc7acbe5"
});
this.WooCommerce.getAsync("products").then( (data) => {
console.log(JSON.parse(data.body));
// this.products = JSON.parse(data.body).products;
}, (err) => {
console.log(err)
})
}
}