Overview of Handlers
This topic describes handlers in Optimizely Configured Commerce.
Handlers are objects that are responsible for the heavy lifting of objects and processing of business logic.
How it works
In the Configured Commerce architecture, handlers take control right after the REST API receives and initially processes the request. Each handler is part of a larger handler chain that operates on specific objects.
When a handler chain is executed, each handler in the chain is executed in a configured order until no more handlers are available in the chain. Below are some existing handler chains that showcase just some of the use cases for handlers.
- GetCartHandler chain - This chain retrieves and returns the cart object for the currently authenticated user or using a specific cart identifier. This chain also includes handlers that retrieve cart-related data, like cart lines, shipping costs, taxes, and available carriers. This chain is executed indirectly throughout the Storefront, including when a user visits the Cart page, navigates to the Checkout Address page, and proceeds to the Review and Pay page.
- GetProductHandler chain - This chain retrieves a product given a product identifier. This chain is executed when a user visits the Product Detail page or searches for a product on the Quick Order page.
Handler chains make it possible to add new handlers and insert new business logic into the chain. See Working with Handlers to add a new handler to a handler chain.
Updated 2 months ago