napps create-extension, then
adapt the business rule to your shop.
All examples use @napps/component-extension types. App extensions run business logic and edit
native-provided data; use @napps/nodes when you need to render
custom React UI.
Product listing formatter
Add a tag to discounted products and hide products from a restricted vendor.ProductTag is provided by the extension runtime as a global constructor.
Collection filters
Apply a default order and preselect a value only when the filter exists.Initial runs before the collection query. UserFiltersChanged runs after the customer changes
filters and before the updated query. Filter methods return false when the requested filter or
value is unavailable.
Product detail handler
Format the PDP and block add-to-cart when a rule fails validation.event.data payloads. onBeforeProductAddToCart uses
{ product, variant, quantity }; variant-carrying selection and completion events use
{ product, productVariant }. Return false from cancellable callbacks to stop the native action.
Cart operations
Return a cart operation when a qualifying product is present. Native can invoke this extension more than once, so make the rule converge instead of adding the same mutation forever.CartOperation[] or a promise of that array. The native runner applies the operations and
may run the extension again with the updated cart. Keep each pass deterministic and return an empty
array when no change is needed.
CartOperations is provided by the extension runtime as a global factory object.