JamesUgbanu
react-native-woocommerce-api
JavaScript

A wrapper that connects react Native to the WooCommerce API

Last updated May 12, 2026
49
Stars
8
Forks
0
Issues
0
Stars/day
Attention Score
40
Language breakdown
JavaScript 92.8%
TypeScript 7.2%
โ–ธ Files click to expand
README

react-native-woocommerce-api

Lightweight WooCommerce REST API client for React Native and JavaScript applications.

Installation

npm install react-native-woocommerce-api

JavaScript usage

CommonJS

const WooCommerceAPI = require('react-native-woocommerce-api');

const api = new WooCommerceAPI({ url: 'https://yourstore.com', consumerKey: 'ck_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx', consumerSecret: 'cs_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx', wpAPI: true, version: 'wc/v3', queryStringAuth: true, });

ESM-style import

import WooCommerceAPI from 'react-native-woocommerce-api';

const api = new WooCommerceAPI({ url: 'https://yourstore.com', consumerKey: 'ck_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx', consumerSecret: 'cs_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx', wpAPI: true, version: 'wc/v3', queryStringAuth: true, });

Requests

api.get('products')
  .then((data) => {
    console.log(data);
  })
  .catch((error) => {
    console.error(error);
  });
api.get('orders', { customer: 123, per_page: 100 })
  .then((data) => {
    console.log(data);
  });
api.post('products', {
  product: {
    title: 'Premium Quality',
    type: 'simple',
    regular_price: '21.99',
  },
});
api.put('orders/123', {
  order: {
    status: 'completed',
  },
});
api.delete('coupons/123');

Returning headers with GET requests

api.get('orders', { header: true }).then(({ header, data }) => {
  console.log(header.get('x-wp-total'));
  console.log(data);
});

TypeScript usage

The package now ships with built-in type declarations.

import WooCommerceAPI from 'react-native-woocommerce-api';

type ProductList = { products: Array<{ id: number; name: string }>; };

const api = new WooCommerceAPI({ url: 'https://yourstore.com', consumerKey: 'ck_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx', consumerSecret: 'cs_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx', wpAPI: true, version: 'wc/v3', queryStringAuth: true, });

async function loadProducts(): Promise<void> { const data = await api.get<ProductList>('products'); console.log(data.products[0]?.name); }

API notes

  • url, consumerKey, and consumerSecret are required.
  • Existing public method names remain unchanged: get, post, put, delete, and options.
  • CommonJS usage continues to work.

ยฉ 2026 GitRepoTrend ยท JamesUgbanu/react-native-woocommerce-api ยท Updated daily from GitHub