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. 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.
7. 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”).