Customize Models
Models in SFRA provide a JSON object layer for the application. The models convert objects returned by the B2C Commerce script APIs into pure JSON objects designed for the storefront. The models also apply business logic for the storefront.
A model passed in for rendering a template is assigned to the
viewData
variable. You can add extra properties to the
viewData
variable — properties that are not provided by the
app_storefront_base
cartridge.
Anything in the modules
folder or the
toplevel
folder is globally available and extendable.
You can customize models to:
- Extend the model to include more data to be used when rendering the template
- Add extra models with objects used to render templates
- Change models to be used to render templates in a different framework