@zerodot/woocommerce 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.md +56 -2
- package/dist/index.cjs +1367 -0
- package/package.json +46 -3
- package/woocommerce.svg +1 -0
package/README.md
CHANGED
|
@@ -1,3 +1,57 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @zerodot/woocommerce
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Manage WooCommerce customers, orders, and products, and start a workflow when a coupon, customer, order, or product is created, updated, or deleted. Use it for store sync and order automation.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
In zerodot, go to **System > Nodes** and install **WooCommerce**.
|
|
8
|
+
|
|
9
|
+
Manual: install `@zerodot/woocommerce` where the web app and the worker run, and add it to `ZERODOT_NODE_PACKAGES`.
|
|
10
|
+
|
|
11
|
+
## Nodes
|
|
12
|
+
|
|
13
|
+
### WooCommerce (`woocommerce.api`)
|
|
14
|
+
|
|
15
|
+
Uses the WooCommerce REST API v3 (`/wp-json/wc/v3`).
|
|
16
|
+
|
|
17
|
+
- **Customer**: create, delete, get, get many, update
|
|
18
|
+
- **Order**: create, delete, get, get many, update
|
|
19
|
+
- **Product**: create, delete, get, get many, update
|
|
20
|
+
|
|
21
|
+
Details:
|
|
22
|
+
|
|
23
|
+
- **Delete** uses `force=true`, so the item is removed for always (not moved to the trash).
|
|
24
|
+
- **Get Many** can return all items (at most 5000) or a limit. The node reads pages of 100 items.
|
|
25
|
+
- **Customer** create and update take billing and shipping addresses, names, and metadata. Create also takes a username and a password. **Get Many** filters by email and sorts.
|
|
26
|
+
- **Product** create and update take the price, stock, status, type, sale dates, SKU, slug, descriptions, and more. **Dimensions**, **Images**, and **Metadata** are separate fields. **Categories**, **Tags**, **Cross Sell IDs**, and **Upsell IDs** are IDs with commas between, such as `12,15`. **Get Many** has the filters of the products list (search, SKU, category, tag, price range, status, stock status, and more).
|
|
27
|
+
- **Order** create and update take **Billing**, **Shipping**, **Coupon Lines**, **Fee Lines**, **Line Items**, **Shipping Lines**, and **Metadata**. Create also has **Set Paid**. **Get Many** filters by customer, product, status, dates, and search.
|
|
28
|
+
- A date is ISO 8601, such as `2025-01-31T10:00:00`.
|
|
29
|
+
|
|
30
|
+
When WooCommerce gives an error, the node fails with the message and the code of WooCommerce.
|
|
31
|
+
|
|
32
|
+
### WooCommerce Trigger (`trigger.woocommerce`)
|
|
33
|
+
|
|
34
|
+
Starts a run on one event. Set **Event**:
|
|
35
|
+
|
|
36
|
+
- `coupon.created`, `coupon.updated`, `coupon.deleted`
|
|
37
|
+
- `customer.created`, `customer.updated`, `customer.deleted`
|
|
38
|
+
- `order.created`, `order.updated`, `order.deleted`
|
|
39
|
+
- `product.created`, `product.updated`, `product.deleted`
|
|
40
|
+
|
|
41
|
+
When the workflow is published, the trigger makes a webhook in the store (`POST /webhooks`) with a random secret that the trigger keeps in its state. When the workflow stops, the trigger removes the webhook. You do not set anything in WooCommerce. The address of the trigger must be reachable from the internet.
|
|
42
|
+
|
|
43
|
+
The trigger checks the `X-WC-Webhook-Signature` header: the base64 HMAC-SHA256 of the raw body, with the secret of the webhook. A request with a wrong or missing signature gets status 401 and starts no run. The ping that WooCommerce sends for a new webhook gets status 200 and starts no run. The output is the body of the event (the coupon, customer, order, or product).
|
|
44
|
+
|
|
45
|
+
## Credential
|
|
46
|
+
|
|
47
|
+
**WooCommerce API** (`woocommerce.api`):
|
|
48
|
+
|
|
49
|
+
- `consumerKey` and `consumerSecret`: from **WooCommerce > Settings > Advanced > REST API > Add key**. Give the key read and write access. WooCommerce shows the secret one time only.
|
|
50
|
+
- `url`: the address of the store, such as `https://example.com`.
|
|
51
|
+
- `includeCredentialsInQuery`: set **Yes** when the server does not read the Authorization header (WooCommerce says "Consumer key is missing"). The key and the secret then go in the query of each call.
|
|
52
|
+
|
|
53
|
+
The **Test** button calls `GET /products/categories`. The store address must start with https://. The node refuses http:// addresses, because the keys must not travel in plain text.
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
AGPL-3.0-only
|