Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

woocommerce-rest-api

БесплатноБез исполняемых скриптовНе проверен

Integrate or build headless frontends on WooCommerce using its REST API for products, orders, customers, and coupons with key authentication

finsilabsот finsilabs★ 69 звёзд на GitHub

Об этом скилле

WooCommerce REST API

Overview

WooCommerce ships a versioned REST API (/wp-json/wc/v3/) that exposes products, orders, customers, coupons, and store settings over HTTPS. It uses OAuth 1.0a for non-HTTPS environments and Basic Auth (consumer key/secret) over HTTPS. The official @woocommerce/woocommerce-rest-api Node.js client handles authentication automatically and supports the full CRUD surface.

When to Use This Skill

  • When building a headless storefront that reads products and categories from WooCommerce
  • When integrating WooCommerce with an ERP, CRM, or fulfillment system
  • When creating an order management dashboard outside of WordPress Admin
  • When syncing inventory between WooCommerce and a warehouse or POS system
  • When automating bulk product imports or price updates from an external catalog
  • When building a mobile app that needs access to WooCommerce store data

Core Instructions

  1. Generate API credentials

    In WordPress Admin → WooCommerce → Settings → Advanced → REST API → Add Key:

    • Description: My Integration
    • User: (admin user)
    • Permissions: Read/Write

    This generates a Consumer Key (ck_xxx) and Consumer Secret (cs_xxx). Store them in environment variables, never in source code.

    WOOCOMMERCE_URL=https://mystore.com
    WOOCOMMERCE_CONSUMER_KEY=ck_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    WOOCOMMERCE_CONSUMER_SECRET=cs_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    
  2. Set up the Node.js client

    npm install @woocommerce/woocommerce-rest-api
    
    // lib/woocommerce.ts
    import WooCommerceRestApi from "@woocommerce/woocommerce-rest-api";
    
    export const woo = new WooCommerceRestApi({
      url: process.env.WOOCOMMERCE_URL!,
      consumerKey: process.env.WOOCOMMERCE_CONSUMER_KEY!,
      consumerSecret: process.env.WOOCOMMERCE_CONSUMER_SECRET!,
      version: "wc/v3",
      axiosConfig: {
        timeout: 15000,
      },
    });
    
  3. Query products with filtering and pagination

    // lib/products.ts
    interface ProductQuery {
      page?: number;
      perPage?: number;
      category?: number;
      status?: "publish" | "draft" | "private";
      stockStatus?: "instock" | "outofstock" | "onbackorder";
      orderby?: "date" | "popularity" | "price" | "title";
    }
    
    export async function getProducts(params: ProductQuery = {}) {
      const response = await woo.get("products", {
        page: params.page ?? 1,
        per_page: params.perPage ?? 20,
        status: params.status ?? "publish",
        stock_status: params.stockStatus,
        orderby: params.orderby ?? "date",
        category: params.category,
      });
    
      return {
        products: response.data,
        totalPages: parseInt(response.headers["x-wp-totalpages"]),
        totalProducts: parseInt(response.headers["x-wp-total"]),
      };
    }
    
    export async function getProductById(id: number) {
      const response = await woo.get(`products/${id}`);
      return response.data;
    }
    
    // Get product variations
    export async function getProductVariations(productId: number) {
      const response = await woo.get(`products/${productId}/variations`, {
        per_page: 100,
      });
      return response.data;
    }
    
  4. Create and manage orders

    // lib/orders.ts
    interface OrderLineItem {
      product_id: number;
      variation_id?: number;
      quantity: number;
    }
    
    interface CreateOrderParams {
      billing: {
        first_name: string;
        last_name: string;
        email: string;
        address_1: string;
        city: string;
        postcode: string;
        country: string;
      };
      line_items: OrderLineItem[];
      payment_method?: string;
    }
    
    export async function createOrder(params: CreateOrderParams) {
      const response = await woo.post("orders", {
        ...params,
        status: "pending",
        payment_method: params.payment_method ?? "stripe",
        payment_method_title: "Credit Card",
        set_paid: false,
      });
      return response.data;
    }
    
    export async function updateOrderStatus(
      orderId: number,
      status: "pending" | "processing" | "on-hold" | "completed" | "cancelled" | "refunded",
      note?: string
    ) {
      const updateData: any = { status };
      if (note) {
        // Add an order note
        await woo.post(`orders/${orderId}/notes`, { note });
      }
      const response = await woo.put(`orders/${orderId}`, updateData);
      return response.data;
    }
    
    export async function getOrders(params: {
      status?: string;
      after?: string; // ISO 8601 date
      page?: number;
    } = {}) {
      const response = await woo.get("orders", {
        status: params.status ?? "processing",
        after: params.after,
        per_page: 50,
        page: params.page ?? 1,
      });
      return {
        orders: response.data,
        totalPages: parseInt(response.headers["x-wp-totalpages"]),
      };
    }
    
  5. **Manage inventory and product u

Полный SKILL.md на GitHub

Установить woocommerce-rest-api в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

claude-code
cursor
gemini-cli
copilot
codex-cli
kiro
opencode

Вложенные файлы

evals/bulk-product-sync-with-concurrency-contr/criteria.jsonevals/bulk-product-sync-with-concurrency-contr/task.mdevals/order-creation-and-status-management-wit/criteria.jsonevals/order-creation-and-status-management-wit/task.mdevals/paginated-product-catalog-with-increment/criteria.jsonevals/paginated-product-catalog-with-increment/task.mdtile.json

FAQ

Что делает скилл woocommerce-rest-api?

Integrate or build headless frontends on WooCommerce using its REST API for products, orders, customers, and coupons with key authentication

Как установить скилл woocommerce-rest-api?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл woocommerce-rest-api запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить woocommerce-rest-api с