Calling custom extension points with HookMgr
Key Takeaway
HookMgr.callHook runs all hooks registered for an extension point, in cartridge-path order, and returns only the last hook's value. If no hook and no system default implementation exists, callHook returns undefined instead of throwing.
A hook is an extension point in B2C Commerce business logic where you register scripts to customize behavior. With a custom hook, you define your own extension point name and register a script for it in your cartridge. You then call the hook from your code with the dw.system.HookMgr class.
OCAPI hooks and custom hooks
A storefront application can use two kinds of hooks. OCAPI hooks are extension points that B2C Commerce provides to run scripts before or after specific OCAPI calls. Custom hooks are extension points you define yourself and call from your own code with HookMgr methods.
You can access a custom hook from either OCAPI or storefront code. So custom hooks are useful for shared functionality across a multichannel set of applications based on the same site.