WooCommerce API NPM implementation

How can i implement this woocomerce rest api to ionic 2?

I tried to import it but it’s not working


Can you share what you’ve tried? Can’t really help out too much if we don’t know what you’ve tried to do?

@mhartington I installed , below are the screenshots my implementation.


The npm package you posted isn’t meant to be used in the browser.
It’s a node package that’s meant to be used on a node-server.
Not loaded in the browser

Thank you. I will try to find other solution.

Did you find any solution on implementing Woocommerce on Ionic2 App? I’m trying to do the same thing…

You can try this one, this works for me.

add in the index.html

      <script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/hmac-sha1.js"></script>
<!-- sha256 -->
   <script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/hmac-sha256.js"></script>
   <script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/enc-base64-min.js">        </script>
<script src="oauth-1.0a.js"></script>

   var oauth = new OAuth({
        consumer: {
            public: 'ck_ public key here',
            secret: 'cs_ secret key here'
        signature_method: 'HMAC-SHA1'

Just follow the guidelines below:

First thank you for your answer! Nice community over there…

Please would you be so kind as to show me the full process?

  • I added the scripts you provided me to index.html with my ck_ & cs_(triple check they’re matching)

  • Then change my url to http://urlBase/projet_mobile/wc-api/v3/products in my wordpress.service.ts

  • Then return this._http.get(url).map(res => res.json());

  • Then on my wordpress.ts : ngOnInit() {
    response => this.response = response,
    error => console.log(error));

And finally {{response | json}} to see content.

In the console log I have the following error:

XMLHttpRequest cannot load http://url/projet_mobile/wc-api/v3/products. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:8100’ is therefore not allowed access. The response had HTTP status code 404

Would be awesome to get this thing working, as I’ve been fighting with this for over 3weeks…
Sorry for my noobness(and my poor english), I just started coding…

My best regards,


you may try either add this in your wordpress functions.php

    add_action( 'init', 'allow_origin' );
       function allow_origin() {
        /* or you can specify the origin e.q http://localhost */
         header("Access-Control-Allow-Origin: *");


   <meta http-equiv="Content-Security-Policy" content="script-src * 'unsafe-inline' 'unsafe-eval'">

Ok thanks I added it to the header of the woocommerce theme functions.php theme.

But now I have a problem with the oauth_consumer_key missing:

Response {_body: "{"errors":[{"code":"woocommerce_api_authentication…aram\u00e8tre oauth_consumer_key est manquant"}]}", status: 404, statusText: "Ok", headers: Headers, type: 2…}
"{"errors":[{"code":"woocommerce_api_authentication_error","message":"Le param\u00e8tre oauth_consumer_key est manquant"}]}"

Can you show me how you built your oauth Authentication? Thank you very much, really appreciate the help.

Hello guys can you please add more details on how to implement this solution i have the same issue and i couldnt’t make this work and running out of options

change your import ‘woocommerce-api’ to import { WooCommerceAPI } from ‘woocommerce-api’;

Hi everyone.
Did Someone could integrate woocommerce REST api module at ionic 2 framework?
i’ll been grateful for some help.

Hi @JosephMendez where I have to define the WooCommerce implementation block?

please any one can help me for similar problem here ?