Function
What is a Function?
Functions is the secret sauce of Ollie Shop. Is where the magic happens.
All Functions run server-side guaranteeing security and maximum performance.
Use functions to run the business logic of the customization. Make requests to external systems, transform payloads, go crazy.
Execution Timing
Configure when your function runs:
-
Request: Execute before sending data to your e-commerce platform
- Example: Validate cart quantity limits before adding items
-
Response: Execute after the platform processes the request
- Example: Hide payment methods based on new cart total
Error Handling
Configure how your function responds to errors:
- Throw: Abort the operation and return a 4xx error to the user
- Skip: Continue processing without raising errors
Use the Ollie SDK’s Reject
function to return structured error responses:
Function Requirements
Functions follow the same structure as Components:
Required Files
- TypeScript file - Your function logic
- package.json - Dependencies and metadata
- node_modules/ - Installed dependencies
Functions don’t require CSS files since they run server-side
Basic Function Structure
Deployment
Deploy functions using the Ollie Builder API:
- Compress your function folder as a ZIP file
- Use the API with your function ID
- Associate with the appropriate Version
Development Guide
Learn how to build and deploy Functions step-by-step