What this article covers
This article explains how to configure MegaScripts that can automatically create orders directly from an HTML form — without requiring a customer to log in or complete the standard checkout process.
You’ll learn how this feature works, what it includes, and how to implement it for workflows such as sample requests, internal ordering, or campaign landing pages.
About this feature
The Form-to-Order Automation enhancement extends Infigo’s MegaScripts system to support order creation from standalone web forms.
When a form is submitted, the MegaScript collects the submitted data, creates a customer (if needed), and places an order automatically.
This allows storefront managers to build custom workflows — for example, product request forms, branded portals, or marketing landing pages — that feed directly into Infigo’s production flow.
This automation removes friction for users who don’t need to browse or check out, while still maintaining full tracking and reporting within the platform.
What’s included
-
Ability to trigger MegaScripts from form submissions
-
Automatic customer creation if the user doesn’t exist
-
Full order placement via API
-
Support for field mapping between form data and order models
-
Configurable success and error pages for user feedback
-
Variable substitution for flexible, reusable script configurations
Key settings
-
Trigger Event:
Set to Place Order or Form Submit to initiate order creation on form submission.
-
Variable Mapping:
Defines how form field names map to order data (e.g., ${email}, ${first_name}, ${quantity}).
-
Default Variables:
Allows preset values or fallback behaviour for missing inputs.
-
Success/Error Pages:
Optional redirect URLs displayed based on whether the API call succeeds or fails.
-
MegaScript Configuration JSON:
Used to define field mappings, default variables, and customer/order logic.
Use cases
-
Sample request forms: Visitors can request free samples that are logged as orders automatically.
-
Internal job requests: Internal users can submit forms that generate production tickets without going through checkout.
-
Marketing campaign pages: Capture orders directly from microsites or promotions.
-
Automated B2B workflows: Create templated forms for recurring business customers.
Step-by-step implementation
Step 1 – Create a MegaScript
-
Go to Admin → MegaScripts → Add New.
-
Set Trigger Type to On Event and choose Place Order.
-
In the configuration JSON, define your mappings. Example:
-
Save the MegaScript.
Step 2 – Attach the MegaScript to your storefront
-
Navigate to Connect → Scripting.
-
Select your storefront and add the MegaScript you just created.
-
Set the Trigger Event to Place Order or Form Submit.
-
Save changes.
Step 3 – Build or connect your web form
-
Create a simple HTML form that collects order information (e.g., name, email, quantity, product).
-
Ensure form field names match your variable mappings (e.g., first_name, last_name, email).
-
Configure the form action to post data to the MegaScript endpoint.
đź’ˇ If you’re using Infigo’s front-end form tools, map each form field to its variable in the MegaScript configuration.
Step 4 – Define response pages (optional)
-
In your MegaScript configuration, specify URLs for successPage and errorPage.
-
Users will automatically be redirected to these pages depending on the outcome.
Step 5 – Test the flow
-
Submit your form with sample data.
-
Verify in Admin → Orders that a new order has been created.
-
Check that customer data, product details, and quantity fields match the form submission.
-
Review MegaScript logs to confirm successful API responses.
Tips & best practice
-
Keep field names simple and consistent across forms.
-
Use default variables to provide fallback values for optional fields.
-
Enable logging (logLevel: 4) for detailed troubleshooting.
-
Test error handling thoroughly to ensure smooth user experience.
-
Combine with other integrations (e.g., HubSpot or CERM) to extend automation chains.