@Hammad6264 wrote:
HI friends hope you will be fine. Actually I am working with ionic 4 and woocommerce. When i try ti use wocommerce plugin which is this one ( https://www.npmjs.com/package/woocommerce-api ). i get an error:
;Here is my code:
import { Component } from '@angular/core'; import * as HA from 'woocommerce'; @Component({ selector: 'app-root', templateUrl: 'app.component.html' }) export class HomePage { Woocommerce: any; constructor( ) { this.Woocommerce = HA({ url: 'https://mysite.com', consumerKey: 'ck_key', consumerSecret: 'cs_key', wpAPI: true, version: 'wc/v3', }); this.Woocommerce.getAsync("products").then( (data) => { console.log(data); }, (err) => { console.log(err); }); } }I also tried to use this code in packge.json file to solve this error:
"browser": { "http": false, "https": false, "net": false, "path": false, "stream": false, "tls": false, "fs": false, "crypto": false, "zlib": false, "sshpk": false },And i was successfull to get rid of this error but this simply ignore these file and then error occur global is not defined.
I used this code in index.html file file to get rid global error:
<script> if (global === undefined) { var global = window; } </script>It worked but then i get error prototype is not defined.
Please help??
Posts: 1
Participants: 1

