Documentation Index
Fetch the complete documentation index at: https://docs.launchmystore.io/llms.txt
Use this file to discover all available pages before exploring further.
Functions
Functions allow your app to run custom business logic at key points in the commerce flow. Unlike extensions (which add UI), functions modify behavior.Function Types
Shipping Rate
Add custom shipping options and rates
Payment Customization
Hide, rename, or reorder payment methods
Delivery Customization
Modify delivery option display
Cart Transform
Modify cart line items, merge/split products
Order Validation
Block orders that don’t meet criteria
Discount
Apply custom discount logic
How Functions Work
Functions are declarative JSON manifests that describe the logic to apply. The LaunchMyStore backend executes them at the appropriate time.Function Manifest
Functions are defined in your app’s extension directory:Execution Points
| Function Type | When It Runs | What It Modifies |
|---|---|---|
shipping_rate | verifyCart() | Adds shipping options |
payment_customization | verifyCart() | Payment method list |
delivery_customization | verifyCart() | Delivery option labels |
cart_transform | verifyCart() | Cart line items |
order_validation | addClientOrder() | Blocks/allows order |
discount | verifyCart() | Applies discounts |
Input Data
Functions receive context about the current cart and checkout:Output Format
Each function type has a specific output format:Shipping Rate Output
Payment Customization Output
Order Validation Output
Testing Functions
Use the Function Sandbox in the developer portal to test your functions before deployment:- Go to Apps → Your App → Functions
- Select the function type
- Enter test input JSON
- Click Run Test
- View the output and execution time
Rate Limits
Functions must complete within:- Execution timeout: 2 seconds
- Memory limit: 128 MB
Best Practices
Keep functions fast
Keep functions fast
Functions run synchronously during checkout. Slow functions hurt conversion rates.
Handle edge cases
Handle edge cases
Always return valid output, even for unexpected input. Use sensible defaults.
Test thoroughly
Test thoroughly
Use the sandbox to test with various cart configurations before deploying.
Version your functions
Version your functions
Use app versioning to roll back if a function causes issues.