Turn your WooCommerce store into a modern, lightning-fast online shopping experience ⚡
A complete toolkit that connects your WooCommerce store to any website or app. Build faster, more flexible online stores without the WordPress frontend limitations.
🚨 IMPORTANT NOTICE: This SDK is currently in active development and should NOT be used in production environments. We are still implementing core features and the API may change significantly.
Current Status:
What this means for you:
Want to be notified when it's production-ready? Watch this repository or follow our progress in the project roadmap.
Imagine you have a WooCommerce store, but you want to create a custom shopping website that's faster, more beautiful, and exactly what you envision. This SDK is the bridge that connects your custom website to your WooCommerce store's data and functionality.
In simple terms: Keep using WooCommerce for managing your products and orders, but build your customer-facing website however you want.
Traditional WooCommerce | With This SDK |
---|---|
😓 Slow page loads | ⚡ Lightning fast websites |
🔒 Limited by WordPress themes | 🎨 Complete design freedom |
📱 Mobile experience varies | 📱 Perfect mobile experience |
🛒 Basic shopping features | 🚀 Advanced shopping features |
🔧 Complex customizations | ✨ Simple, clean code |
npm install @woo-headless/sdk
import { WooHeadless } from '@woo-headless/sdk';
const store = new WooHeadless({
baseURL: 'https://your-store.com',
consumerKey: 'your_consumer_key', // Get from WooCommerce settings
consumerSecret: 'your_consumer_secret' // Get from WooCommerce settings
});
// Get your products
const products = await store.products.list();
// Add to cart
await store.cart.addItem({
productId: 123,
quantity: 2
});
// Complete checkout
const order = await store.checkout.completeOrder();
That's it! You now have a fully functional online store. 🎉
Let's say you want to build a modern online clothing store:
// Create your store connection
const clothingStore = new WooHeadless({
baseURL: 'https://your-fashion-store.com',
consumerKey: 'ck_your_key',
consumerSecret: 'cs_your_secret'
});
// Build a product page
async function showProduct(productId) {
const product = await clothingStore.products.get(productId);
if (product.success) {
// Display product name, images, price, sizes, colors
console.log(`${product.data.name} - $${product.data.price}`);
// Show available sizes/colors
product.data.variations.forEach(variation => {
console.log(`${variation.attributes.size} - ${variation.attributes.color}`);
});
}
}
// Add item to cart when customer clicks "Add to Cart"
async function addToCart(productId, size, color) {
const result = await clothingStore.cart.addItem({
productId: productId,
quantity: 1,
variation: { size: size, color: color }
});
if (result.success) {
console.log('Item added to cart!');
updateCartDisplay(); // Update your website's cart display
} else {
console.log('Oops! ' + result.error.message);
}
}
// Complete the purchase
async function checkout(customerInfo) {
// Set customer information
await clothingStore.checkout.setCustomer(customerInfo);
// Complete the order
const order = await clothingStore.checkout.completeOrder();
if (order.success) {
console.log(`Order #${order.data.number} created successfully!`);
// Redirect to thank you page
}
}
Frontend Frameworks:
Mobile Apps:
Backend/Server:
const store = new WooHeadless({
// Your WooCommerce store URL
baseURL: 'https://your-store.com',
// API credentials from WooCommerce settings
consumerKey: 'ck_your_consumer_key_here',
consumerSecret: 'cs_your_consumer_secret_here',
// Optional: Enable caching for faster loading
cache: {
enabled: true,
duration: 5 // Cache for 5 minutes
}
});
// Get featured products for homepage
const featured = await store.products.list({ featured: true, limit: 8 });
// Search products
const searchResults = await store.search.products('wireless headphones');
// Get products by category
const electronics = await store.products.list({ category: 'electronics' });
// Add products to cart
await store.cart.addItem({ productId: 123, quantity: 2 });
// View cart contents
const cart = await store.cart.get();
console.log(`Cart total: $${cart.total}`);
// Apply a discount code
await store.cart.applyCoupon('SAVE20');
// Set customer information
await store.checkout.setCustomer({
firstName: 'John',
lastName: 'Smith',
email: '[email protected]',
address: '123 Main St, City, State 12345'
});
// Complete the purchase
const order = await store.checkout.completeOrder();
The SDK uses a simple success/error pattern that's easy to understand:
const result = await store.products.get(123);
if (result.success) {
// Everything worked! Use result.data
console.log('Product name:', result.data.name);
} else {
// Something went wrong, show user-friendly message
console.log('Error:', result.error.message);
}
Common error scenarios handled automatically:
We've thoroughly tested this SDK with real WooCommerce stores:
View our test results: Integration Testing Results
See live examples: Test Scripts & Real Order Creation
We're constantly improving this SDK based on your feedback:
Coming Soon:
"We moved from a slow WooCommerce theme to a headless setup with this SDK. Our site speed improved 5x and conversions increased 40%!"
— Sarah, Fashion Store Owner
"As a developer, this SDK saved me months of work. The documentation is excellent and everything just works."
— Mike, Web Developer
MIT License - Use this for any project, commercial or personal.
# Install the SDK
npm install @woo-headless/sdk
# Follow our 5-minute quick start
# Build something amazing! 🎉
Questions? We're here to help! Join our Discord community or check out our documentation.
Built by developers, for developers. Simple to use, powerful when you need it. ⚡