Solve Business Challenges
Add validation rules, dynamic pricing, inventory checks, and custom integrations. Transform checkout data with your exact business requirements.
Zero Infrastructure
Deploy instantly without managing servers. Functions scale automatically from one order to millions. Pay only when they run.

All Functions run server-side guaranteeing security and maximum performance.
This page explains the idea with one example. The reference lives in the Functions section: the handler contract, triggers, session storage and cookies, and deploying.
Function Triggers
Functions run on Ollie’s serverless runtime, which stores and runs your custom code. The most important aspect of a Function is to determine when it should be executed, meaning what will trigger the Function. Given the headless nature of Ollie Shop, there are many HTTP requests flowing between the checkout server and your platform. A trigger names one of them: a URL, plus a condition on the method, headers, body or status. See Triggers for the full list of calls and the condition language.Example - execute function when the user adds their email to the cart
Let’s say you want to run a customization that runs a background check every time the user adds an email to the cart. The traditional way of thinking about this problem is to build a new textbox component and, in this component, use a library such as Axios to fetch an external API directly from the component. Clear downsides is that you’ll depend on the browser, and also the front-end developer will have to know how this external API works. With Ollie this is not required. You know that there is already a textbox where the user will enter their email, the Contact Step in your checkout process. You also know that this action will use the Ecommerce Provider API to add the email to the cart data.Example: the VTEX API that adds the client profile data - accountName.myvtex.com/api/checkout/pub/orderForm/:orderFormId/attachments/clientProfileData

Ollie Shop Functions can be seem as interceptors of HTTP requests.
response /api/checkout/pub/orderForm/:orderFormId/attachments/clientProfileData
By using the “Add Profile to Cart” as a trigger we are taking advantage of the fact that in a normal checkout flow you want the user to add their email to the cart. We are “piggybacking” on an action that was already meant to happen
clientProfileData.email - and use this data in the custom code you deployed to the function.
Below an example of how to use the payload inside a function
Example of how to use the available request/response payload in a function
clientProfileData.backgroundCheck
response of the original HTTP enriched with the Function
Function Types
Invocation TypeRequestruns before the HTTP request set as the trigger is sent to the platformResponseruns after the platform answered, with access to the response
Request Functions
intercept an HTTP request and modify the payloadUse them for validation, data modification, and pre-processing logic.
Response Functions
intercept an HTTP request and modify the responseUse them for post-processing, integrations, and response enhancement.
Error Handling Strategies
Understanding error handling is crucial for building reliable checkout flows:- Throw - an error message will appear for the user
- Skip - the user will continue it’s journey and the error will be suppressed.

Best Practice: Use
throw for anything that affects order validation or payment. Use skip for analytics, logging, and optional features.Priority
If you need to trigger multiple functions using the same trigger, you can use thepriority feature. This creates an order in which Ollie Shop will trigger your functions. When a functions is triggered it will use the data made available from the previous function.
Priority starts with 0 (zero), the lowest number runs first, and currently there are no limits on the number of functions you can trigger.