b2c-hooks
Register and implement B2C Commerce platform hooks -- scripts registered in a cartridge's hooks.json and invoked by HookMgr during OCAPI/SCAPI requests or system events. Applies ONLY to writing or debugging code registered in hooks.json and called by the HookMgr dispatcher. Key identifiers: hooks.json, HookMgr.callHook(), dw.system.Status returns, dw.ocapi.shop.* extension points (beforePOST/afterPOST/modifyResponse), dw.order.calculate, app.payment.processor.*. Covers hook script authoring, registration, Status OK/ERROR/rollback semantics, request.custom inter-hook data passing, and custom extension points. Do NOT trigger for these even if the query mentions hook or order: outbound webhook/notification endpoints on external Node.js/Express services (not hooks.json-registered); SFRA controller routes, middleware, or prepend/append chains; scheduled job step modules (execute/beforeStep/afterStep in steptypes.json, not hooks.json); Git or CI hooks (husky, pre-commit).
Pinned to revision bee72c26e342, so it is the text this page describes rather than whatever the author pushed since.
Files
- skills/b2c-hooks/SKILL.md
- skills/b2c-hooks/evals/trigger-evals.json
- skills/b2c-hooks/references/OCAPI-SCAPI-HOOKS.md
- skills/b2c-hooks/references/ORDER-HOOK-LIFECYCLE.md
- skills/b2c-hooks/references/SYSTEM-HOOKS.md
Every link opens the file at its source, pinned to the revision this page describes.