Get Started

DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK

Allows an app dev to generate extra fields in the in-memory backend. This enables the in-memory drivers to return responses similar to what the frontend would expect from the production platform.

The value returned by the hook function will be set to the returned cart's extra_attributes field for driver calls that return a cart.

Note that this and any extra_attributes features are for advanced users and should be used with care.

Examples

Adding the `numberOfCartItems` field to `extra_attributes`

(reqInfo: RequestInfo, cart: DaffCart) => ({
  numberOfCartItems: cart.items.length
})
Graycore, LLC © 2018 - 2025. Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.