Skip to main content

WooCommerce

Purpose​

Orders, catalog, customers, and inventory. Same marketplace registration pattern as Shopify.

Authentication​

Consumer key and secret in the vault. A key revoked or deleted in WooCommerce answers every call with 401 woocommerce_rest_authentication_error; the client then marks the connection DISCONNECTED, which puts it on the platform dashboard's broken-connections list. Connecting the store again restores it.

Client​

The REST API is wc/v3. A read is retried after a gateway error (502, 503, 504, 522) or a dropped connection; a write is not, since it may have gone through and a second POST could add a second note or refund. A 429 from the host is retried for any request, after its Retry-After (at most 30 seconds). getIn / postIn call another plugin's REST namespace on the same store with the channel's credentials.

Orders​

Pulled on the sync scheduler by modified date (modified_after, with dates_are_gmt so the UTC watermark is not compared with the store's local time), in ascending id order so pages stay stable while orders arrive. A first sync reads 60 days back. The watermark moves when the window is read to the end. An order that fails on its own is kept (woocommerce:order-sync:failed:<channelId> in the cache, 7 days) and re-read by id at the start of the next run, up to 25 a run, rather than holding the watermark; without the cache the watermark holds. Same rule for every channel; see Integrations overview.

  • COD is never paid according to WooCommerce, which puts a COD order straight into processing and may stamp date_paid with no money moved. Its payment status is COD_PENDING until PointNXT records money (a partial advance, the COD remittance); what PointNXT recorded is never lowered by a sync.
  • failed is a declined payment the buyer can retry, not a cancellation: it maps to PENDING and unpaid, so the payment hold parks it until WooCommerce reports it paid.
  • Refunds recorded on the order make the payment PARTIALLY_REFUNDED or REFUNDED. An order refunded before anything shipped has its lines CANCELLED; after shipping, RETURN_ACCEPTED.
  • checkout-draft orders (a block-checkout cart not yet placed) are skipped.

Direction​

Outbound order service, when manageState is on. Status changes WooCommerce itself reported are never pushed back (see order.status.changed in Events).

  • CONFIRMED and PARTIALLY_FULFILLED → processing; FULFILLED, DELIVERED and CLOSED → completed; CANCELLED → cancelled.
  • ON_HOLD is not pushed. PointNXT holds are internal; WooCommerce on-hold means awaiting payment and emails the buyer.
  • Tracking is added before the status, so WooCommerce's "completed" email can carry it: each forward parcel PointNXT shipped (origin: OMS), once. With the Shipment Tracking extension (wc-shipment-tracking/v3) it goes there; without it (rest_no_route), into a customer-visible order note. A failure to add tracking never blocks the status.
  • Refund on cancel: with the channel setting refundOnCancel on (default off), a paid, non-COD order cancelled in PointNXT is refunded through the store's gateway (api_refund), only for what WooCommerce has not refunded already, without restocking.

Webhooks​

Public webhook controller; deliveries go to webhook_queue and are re-read from the API before ingesting. Topics registered: order.created, order.updated, order.deleted (a trashed order maps to cancelled; one deleted for good is cancelled through transitionFromChannel), order.restored, product.created, product.deleted (the product's listings, and its variations', are archived: REMOVED_ON_CHANNEL, as the full-sync resweep does), customer.created, customer.updated. The health service reactivates disabled webhooks and emits audit.log; a missing one is re-created only on an explicit check, since merchants can see and delete webhooks in the WooCommerce admin.

Catalog​

external (affiliate) and grouped products, and trashed ones, are not imported: there is nothing to stock or ship. Weights and dimensions are read in the store's own units (WooCommerce > Settings > Products, read once an hour per channel); the channel's weightUnit / dimensionUnit settings apply only when the store will not say, or uses metres or yards.

Inventory​

Flush job flush-channel:WOOCOMMERCE. Bulk publish can pace itself (selfPacesRateLimit) through InventoryRateLimiterService. Reads take products, and each parent's variations, 100 to a list call.

Code​

src/integrations/woocommerce.

Failure​

Shared circuit breaker and webhook queue (8 attempts) when the handler uses WebhookQueue. Confirm the controller before assuming every Woo route is queued.

Payment references​

Order import records payment_method + transaction_id (paid at date_paid_gmt) as an OrderPaymentTransaction when the method is a recognised gateway (toWooCommercePaymentReferences in woocommerce-order.service.ts). COD, bank transfer and cheque are not recorded. WooCommerce orders never appear on a marketplace settlement report; they reconcile through Payment gateway settlements or COD remittances.