What Is the Prepopulate Data Script?
The Prepopulate Data Script allows you to automatically fill specific text fields in your MegaEdit product with data from your users’ accounts. This is especially helpful for personalizing products (e.g., business cards, address labels) with the user’s name, email, address, or any custom data fields you have enabled in their profile.
1. How to Enable Prepopulate Data
- Go to Admin > Catalog > Product Types > MegaEdit > MegaEdit Products.
- Edit the product where you want to enable the script.
- Go to the Scripts tab.
- Enable the “Prepopulate Data Script”.
- Save changes.

When enabled, a new button called “Prepopulate Data” appears in the MegaEdit interface whenever you select a text field.

2. How to Use in MegaEdit
- Open the product in your store (as a normal, logged-in customer).
- Select a text field in the MegaEdit design.
- Click the “Prepopulate Data” button. A menu will appear showing the standard user-profile fields (e.g., first name, last name, email, etc.).
- Select one of the available data fields.
- For example, “Customer Full Name” or “Customer Email.”

- Once selected, the text field is “tagged” so that it will pull the correct user information.

- Save your design (via Menu > Save product default).
Note: You can only assign one data field per text field (e.g., one text field can’t hold both first name and email at the same time in this setup).
3. Available Data Fields
The script supports a variety of standard fields from the user’s profile:
- Customer Info: Full Name, First Name, Last Name, Email, Gender, Title, Date of Birth, Phone, Fax, Company Name, etc.
- Address Fields: Address Line 1, Address Line 2, City/Town, County/Region, Country, Postal Code, etc.
-
Custom Fields: If you have custom fields configured in your registration (e.g., Custom Field 1, 2, 3), you can use these by selecting or manually entering the tag:
4. Important Update: New Fallback Logic vs. Legacy Logic
We’ve introduced new fallback logic to better manage how data is retrieved between Customer Info, Billing Address, and Shipping Address. Previously, certain fields always came from Customer Info, while others came from billing/shipping addresses, which could cause confusion or inconsistencies.
New Default Logic (Recommended)
- Customer Info: First, the script checks if relevant address fields (Address Line 1, City, etc.) are present in Customer Info. If they are, it uses them.
- If the address fields are not in the Customer Info, the script attempts to fallback to the user’s Billing Address or Shipping Address (or the first available address).
- If no suitable data is found in those addresses, it moves on to any additional addresses.
Legacy Logic (Optional)
If you prefer how the script behaved before, you can revert to the old logic. In the old logic, the script always tried the billing address first, then any other addresses, and certain fields like first name, last name, and email always came from Customer Info.
Enabling Legacy Logic
If you open the script configuration (within the Scripts tab for your product), you’ll see or can add a JSON-style block:
Setting legacyMapping to true reverts to the old approach.
Note: If legacyMapping is set to false or omitted, the new flow is used.

5. New Address Prefixes: billing_ and shipping_
We have added explicit prefixes so you can force certain fields to always use Billing or Shipping data without fallback. For example:
prepopulate_billing_addressline1
prepopulate_shipping_postalcode
Using these prefixes ensures the data comes only from that specific address type—if the data isn’t set in that address, it won’t try any other source.
6. Locating Selected Tags
- Select a text field in MegaEdit.
- Bring up the pop up menu and navigate to the Details tab.
- Locate the Tags field.
- Any previously selected tag (specified using the Prepopulate Data button) should appear in here. You can also manually amend the selected tag, such as with the shipping_ or billing_ options above.

7. Saving Product Defaults After Changing a Prepopulated Value
If a text field has been configured to prepopulate with user data, but a different value is manually selected in the editor and the design is saved as a new Product Default, the newly selected value will override the original prepopulated setting.
For example:
-
A field is configured to prepopulate with a specific email address from a dropdown list.
-
A user opens the product in MegaEdit and selects a different email address from the dropdown.
-
The user saves the design using Menu → Save Product Default.
After this point, the newly selected value becomes the default value for that field.
This means:
If you want the field to continue using the prepopulate data script, you will need to ensure the correct prepopulate tag remains assigned to the text field.
You can verify this by:
-
Selecting the text field in MegaEdit.
-
Opening the Details tab.
-
Checking the Tags field to confirm the correct prepopulate_ tag is still present.
If the tag has been removed or replaced by a static value, the field will no longer dynamically pull user data.
8. Testing Your Setup
- Log in with a test user account that has complete profile information.
- Check that the data populates correctly:
- If you’re using the new fallback logic (default), confirm that fields fill from the user’s Customer Info first, then billing/shipping if necessary.
- If you’ve used a
billing_ or shipping_ prefix, confirm those fields always pull from the chosen address and ignore other addresses.
- Log in as a different user (with different address details) to make sure everything is working as intended.
9. Final Tips
- Admin vs. Customer View: You must be in a true “customer” login session to see real data. Admin “emulate user” sessions often do not reveal personal data fields.
- Custom Fields: Make sure your custom fields are enabled in your store’s Customer Settings so they appear as an option to fill.
- Troubleshooting: If any field is not populating, check the script contig or confirm your user’s profile actually has the data (e.g., a billing address with no “City” won’t populate “City”).
10. Troubleshooting
If the Prepopulate Data Script is not working as expected, review the following common scenarios.
Fields Are Not Populating with User Data
If a field does not populate automatically:
-
Confirm the Prepopulate Data Script is enabled under the Scripts tab of the MegaEdit product.
-
Ensure the correct prepopulate_ tag is assigned to the text field.
-
Verify that the user’s account profile actually contains the required data (e.g., address fields, phone number, etc.).
If the user profile does not contain the required information, the field will remain empty.
Data Appears Incorrect or Comes from the Wrong Address
If the populated value is coming from an unexpected address:
-
Check whether the script is using the default fallback logic.
-
If you need to force the value to come from a specific address type, use the explicit prefixes:
For example:
Using these prefixes ensures the data is pulled only from the selected address type.
Fields Stop Prepopulating After Saving a Product Default
If a field previously used a prepopulate tag but stops pulling user data after saving a new Product Default, it may have been overwritten.
This can occur if:
-
A user selects a different value in the editor (for example from a dropdown list).
-
The design is saved using Menu → Save Product Default.
When this happens, the newly selected value becomes the stored default value for that field and replaces the original prepopulate behaviour.
To restore prepopulation:
-
Open the product in MegaEdit.
-
Select the text field.
-
Go to the Details tab.
-
Check the Tags field.
-
Ensure the correct prepopulate_ tag is still present.
If the tag has been removed or replaced with a static value, the field will no longer pull dynamic user data.
Prepopulate Options Do Not Appear in the Editor
If the Prepopulate Data button does not appear when selecting a text field:
-
Confirm the Prepopulate Data Script is enabled on the product.
-
Ensure the selected object is a text field, as the script only works with text objects.
Data Does Not Populate When Testing as Admin
If you are testing while logged in as an administrator, the fields may not populate correctly.
For accurate testing:
-
Log in using a standard customer account with completed profile information.
-
Avoid relying on admin impersonation sessions, as personal data fields may not be accessible in those cases.