Skip to content

feat(ecommerce): add WooCommerce store source - #1671

Merged
sung17 merged 2 commits into
mainfrom
feat/woocommerce-store-source
Nov 9, 2026
Merged

sung17 merged 2 commits into
mainfrom
feat/woocommerce-store-source

Conversation

@sung17

@sung17 sung17 commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • A workspace's ecommerce can now mirror a WooCommerce store, next to Shopify: products, variations, stock, coupons and orders come over the WooCommerce REST API, read-only here; the web shop, carts, triggers, analytics and the public API keep working on the mirrored rows.
  • Shopify-only names become shared by both external stores, so one set of settings, guards and UI covers both.
  • Fixes found on the way that also affect the Shopify store source already on main: the store currency now follows the connected store (it stayed on our own setting, so prices showed in $ and orders were charged in the wrong currency), and switching the store source to Shopify or WooCommerce queues a full sync of it.

Changes

  • Database — new IntegrationWoocommerce table; storeSource / orderSource gain woocommerce. Migration 20261109031056_woocommerce_store_source is hand-edited to rename shopifyCheckoutMethod → externalCheckoutMethod, shopifyAutoApplyDiscounts → externalAutoApplyDiscounts and the Shopify status enums (drizzle generated drop/create, which would lose saved settings). Shopify's catalog writes move to a shared externalStoreRepository with a source parameter.
  • integrations/woocommerce (new) — REST client (Basic auth, query-string fallback for hosts that strip Authorization, no redirects followed), products/variations/coupons/orders/webhooks APIs, Web Crypto webhook signature check.
  • packages/business/src/woocommerce (new) — connect (SSRF-checked on connect and before every use of the keys), sync, mappers, webhooks, checkout. Web Checkout creates a pending WooCommerce order and returns its payment page; it is mirrored only once paid, so an abandoned payment tells nobody anything. In-App places a cash-on-delivery order.
  • packages/business/src/external-store (new) — shared contact lookup, cart clean-up, status ordering, externalStoreManagedException.
  • Settings — externalCheckoutMethod / externalAutoApplyDiscounts (the old shopify* keys are still accepted on update, deprecated); switching to an unconnected store is refused (externalStoreNotConnected); switching takes the store's currency and queues a full sync.
  • Worker — woocommerceSync / woocommerceWebhook jobs under withBlockedOwnerGuard.
  • Builder — woocommerce.* public API (/v1/woocommerce), webhook route /api/woocommerce/[workspaceId]/webhook, Settings → WooCommerce form, products/orders buttons and dialogs moved to features/external-store and shared by both stores, i18n in all 21 locales.
  • CLI/docs — woocommerce is a singleton CLI resource; apps/cli/README.md, new docs/woocommerce.md, updated docs/shopify.md, docs/ecommerce.md, AGENTS.md.

Breaking changes

  • Error code shopifyManaged → externalStoreManaged (data.store names the store).
  • Settings output fields shopifyCheckoutMethod / shopifyAutoApplyDiscounts → externalCheckoutMethod / externalAutoApplyDiscounts (input still accepts the old names).

Migration note

Runs after 20261109000000_ai_file_queued_run_index; the snapshot chain is re-rooted there (db:check-drift clean; db:fix-chain reports only the two issues already on main). Workspaces already selling from Shopify get their currency corrected by Sync Now.

Test plan

  • pnpm lint (incl. db:check-drift, check:invariants)
  • pnpm check-types
  • pnpm test — 67/67 suites (new: WooCommerce mappers, webhooks, sync, public API, currency, store-source switch, legacy settings keys)
  • invariant-guard agent — no violations
  • Manual: connected a local WooCommerce store (Docker, behind a Cloudflare tunnel), synced products, web shop lists them
  • Manual: In-App order, Web Checkout payment, coupon, order status changes firing triggers, disconnect removes webhooks

Mirror a connected WooCommerce store's products, variations, stock, coupons
and orders over its REST API, read-only in ChatbotX, next to Shopify.
Shopify-only names become shared by both external stores
(externalCheckoutMethod, externalAutoApplyDiscounts, externalStoreManaged);
the old checkout keys are still accepted. The store currency follows the
connected store, and switching the store source to one queues a full sync.
@github-actions github-actions Bot added the feature New feature or request label Nov 9, 2026
@sung17
sung17 merged commit 7c3aa93 into main Nov 9, 2026
14 checks passed
hello-jackytruong referenced this pull request in hello-jackytruong/ChatWorkAI Nov 22, 2026
* feat(ecommerce): add WooCommerce store source

Mirror a connected WooCommerce store's products, variations, stock, coupons
and orders over its REST API, read-only in ChatbotX, next to Shopify.
Shopify-only names become shared by both external stores
(externalCheckoutMethod, externalAutoApplyDiscounts, externalStoreManaged);
the old checkout keys are still accepted. The store currency follows the
connected store, and switching the store source to one queues a full sync.

* refactor(woocommerce): drop the unused page count in list pagination

---------

Co-authored-by: Deathgiver <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant