Registry / crm-productivity / woocommerce-api

woocommerce-api

JSON →
library0.1.14jsnpmunverified

The `woocommerce-api` package provides a Node.js client for interacting with the WooCommerce REST API. It allows developers to programmatically manage store data, including products, orders, customers, and more. The client supports both the legacy WooCommerce API (up to v3) and the newer WP REST API integration (wc/v1 for WooCommerce 2.6 and later). The current stable version is 1.5.0. However, this library was officially declared obsolete on July 29, 2019, and no longer receives updates or maintenance. Developers are strongly advised to migrate to the actively maintained and official successor, `@woocommerce/woocommerce-rest-api`, for security patches, bug fixes, and compatibility with future WooCommerce versions. There is no active release cadence for this package, as it is abandoned.

npm install woocommerce-api
INSTALL
IMPORT
SIG · WOOCOMMERCE-API
W
woocommerce-api
crm-productivityjavascriptv0.1.14
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WooCommerceAPI
const WooCommerceAPI = require('woocommerce-api');
import WooCommerceAPI from 'woocommerce-api';
This package is CommonJS-only. ESM import syntax will not work directly and requires a CommonJS wrapper or bundler configuration.

This code demonstrates how to initialize the `woocommerce-api` client and fetch a list of products from a WooCommerce store using the modern WP REST API.

const WooCommerceAPI = require('woocommerce-api'); // IMPORTANT: This library is obsolete and no longer maintained. // Consider migrating to '@woocommerce/woocommerce-rest-api' for active support. const consumerKey = process.env.WOO_CONSUMER_KEY ?? 'ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; const consumerSecret = process.env.WOO_CONSUMER_SECRET ?? 'cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; const storeUrl = process.env.WOO_STORE_URL ?? 'http://your-woocommerce-store.com'; // Replace with your store URL // Configure the client for WooCommerce 2.6+ using the WP REST API const WooCommerce = new WooCommerceAPI({ url: storeUrl, consumerKey: consumerKey, consumerSecret: consumerSecret, wpAPI: true, // Set to true for modern WooCommerce API version: 'wc/v1', // API version (e.g., 'wc/v1', 'wc/v2', 'wc/v3') verifySsl: process.env.NODE_ENV === 'production' // Only verify SSL in production }); // Example: Fetch a list of products WooCommerce.get('products', function(err, data, res) { if (err) { console.error('API Error:', err.message); // data might contain raw error response from WooCommerce if (data) console.error('Raw error data:', data.toString()); return; } try { const products = JSON.parse(res); console.log(`Successfully retrieved ${products.length} products.`); if (products.length > 0) { console.log('First product name:', products[0].name); console.log('First product price:', products[0].regular_price); } } catch (parseError) { console.error('Failed to parse response:', parseError.message); console.error('Raw response:', res); } });
Debug
Known issues
breakingThis `woocommerce-api` client has been officially declared obsolete and will no longer receive updates, maintenance, or security patches since July 29, 2019. Continued use is not recommended.
fix
Migrate your application to the actively maintained and official `@woocommerce/woocommerce-rest-api` library for continued support and security.
affects: >=1.0.0
Errors
Common errors & fixes
Error: self signed certificate in certificate chain
Attempting to connect to a WooCommerce instance with a self-signed SSL certificate without disabling SSL verification.
fix
For development or testing with self-signed certificates, set the `verifySsl` option to `false` in the client configuration (e.g., `verifySsl: false`). Do not use this in production.
Request failed with status code 401: Consumer Key and Consumer Secret are required.
Incorrect or missing API consumer key/secret, or the provided keys do not have sufficient permissions to access the requested resources.
fix
Ensure `consumerKey` and `consumerSecret` are correctly configured in your client options. Verify that the keys generated in your WooCommerce store have 'Read/Write' permissions for the actions you are performing.
Request failed with status code 404: No route was found matching the URL and request method
The configured `url` or `version` is incorrect, or the requested API endpoint path does not exist on the WooCommerce store.
fix
Double-check the `url` to your WooCommerce store, the `version` (`wc/v1` for modern, `v3` for legacy), and ensure `wpAPI: true` is set for WooCommerce 2.6+ when using `wc/v1`.
Upgrade
Version history
0.1.14latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
55 hits · last 30 days
node
48
OpenAI (training)
1
Resources
woocommerce-api — npm install woocommerce-api · libregistry