Loading

B2C Commerce - Hook Checklist

Data pubblicazione: Apr 11, 2025
Risoluzione

Please follow the below steps: 

  1. Request performance and payload contents should be monitored and performance tuned to locate the sweet-spot between payload size and request performance
    • Ex. Instead of pulling 50 products in a request, pull 10 across 5 separate requests
    • Ex. Leverage but don't over-use or poorly implement batch requests
  2. To maximize cache performance, always evaluate the url query parameters attached to an OCAPI request — and sort parameters and parameter values alphabetically.
  3. Only use hooks when necessary
    • hooks introduce dependencies that can impact overall request performance.
    • hooks introduce additional request overhead with their implementation so their use should be driven by a valid business case.
  4. When modifying an OCAPI response, use the web object as much as possible. Only use scriptAPI objects on an as-needed basis and minimize the business logic complexity within a hook.
  5. Avoid requesting persisted objects from within a hook (ex. ProductMgr.getProduct() or product.getVariations()).
  6. The pre- and post-processing logic embedded in a custom hook should be minimized — as this overhead is executed in addition to the overhead of the parent OCAPI request. Depending on the complexity of the custom-hook logic, it may be better to implement the processing as part of a separate request. This should be evaluated on a case-by-case basis, and driven by performance metrics collected from the parent OCAPI request.
  7. Implementation Safeguards
Numero articolo Knowledge

000396790

 
Caricamento
Salesforce Help | Article