360 Secure SkillHub
360 安全技能中心

Skill Dropshipping Fulfillment

核心功能:拉取WooCommerce「处理中」订单,通过SKU映射文件匹配CJ产品变体,提交代发订单到CJ API,同步更新WooCommerce订单状态并添加CJ订单ID备注,全程日志记录。典型场景:跨境电商商家批量/单个处理代发订单,支持 dry-run 预览。需配置Woo、CJ API凭证及SKU映射文件,通过Node.js命令行执行,输出含控制台摘要、履约日志及拒单日志。

zero2ai-hub
zero2ai-hub
热度 56.41
最近更新 2026-05-18 12:10:27
分类:自动化依赖:代码执行 / 读写文件 / 第三方 API应用场景:自动化脚本 / 工作流 / 任务管理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add skill-dropshipping-fulfillment
Metadata
name
skill-dropshipping-fulfillment
description
Automates order fulfillment by pushing WooCommerce orders to CJ Dropshipping. Fetches "Processing" orders, matches line items to CJ variants via a supplier selection map, submits orders to CJ API, updates WooCommerce order status, and logs results. Supports dry-run and single-order modes.
metadata
{"openclaw":{"requires":{"bins":["node"]}}}

CJ Fulfillment Engine

Automates the WooCommerce → CJ Dropshipping order flow. No manual copy-paste.

What it does

  1. Fetches all processing orders from WooCommerce
  2. Maps line items to CJ variant IDs via cj-supplier-selection.json
  3. Submits matched items to CJ API as a dropship order
  4. Updates WooCommerce order status to on-hold (awaiting CJ dispatch)
  5. Adds an order note with the CJ order ID
  6. Logs all results to cj-fulfillment-log.json

Credentials / paths

File Contents
woo-api.json { url, consumerKey, consumerSecret }
cj-api.json { apiKey, baseUrl, accessToken, tokenExpiry }
cj-supplier-selection.json Array of { sku, cjProductId, variantId, ... }

Usage

# Dry run — preview without placing orders
node {baseDir}/scripts/fulfill.js --dry-run

# Fulfill all processing orders
node {baseDir}/scripts/fulfill.js

# Fulfill a single WooCommerce order
node {baseDir}/scripts/fulfill.js --order 1234

cj-supplier-selection.json format

Full 6-field schema — one entry per product variant. Matching is SKU-first with fallback to wooProductId:wooVariationId.

[
  {
    "wooProductId": 77261,
    "wooVariationId": 77265,
    "sku": "CJYD2360896-BLACK",
    "cjProductId": "CJ-PRODUCT-ID",
    "variantId": "CJ-VARIANT-ID",
    "productName": "My Product — Black"
  }
]

Generate or rebuild this file from CJ API automatically:

node {baseDir}/scripts/rebuild-mapping.js

FBA / excluded products

Products that should never be fulfilled via CJ (e.g. FBA, in-house). Set via env var:

FBA_PRODUCT_IDS=75927,75808,2382 node fulfill.js

These are skipped with a log entry: "FBA product — manual fulfillment required".

Output

  • Console: per-order summary with matched/unmatched items and CJ order ID
  • cj-fulfillment-log.json: append-only log with { orderId, status, cjOrderId, timestamp }
  • cj-rejection-log.json: unmatched/skipped items for manual review

Unmatched items

If a line item has no SKU match and no wooProductId:wooVariationId match, it's logged to the rejection log and the order is skipped. Fix by running rebuild-mapping.js or adding the entry manually.

Environment overrides

CJ_SELECTION_PATH=/custom/path/selection.json node fulfill.js
FULFILL_LOG_PATH=/custom/path/log.json node fulfill.js