Magento 2 Form - Predefined Variables
Use predefined variables to show dynamic content of success message and email notifications.
You don’t want to send the same success message and email content to all recipients. You want to make it more flexible and personalized. But how can you do that?
Extremely simple. Just insert our predefined variables in the email content and success message when configuring. Then after a form is submitted, you and customers will receive email notifications and success message in which these variables are automatically replaced with relevant submitted data. Amazing, isn’t it?
Example: In the WYSIWYG editor of success message of a contact form, you insert [name] variable like this "Hi [name], thanks for your submission". A customer fills the "Name" field in the form with her name "Veronica Costello". After submitting the form, she will receive the success message like this: "Hi Veronica Costello, thanks for your submission".
We made it super easy to insert these variables by creating dropdown lists. Hence, you don’t need to spend time typing each variable.
Our custom variables include 2 types:
- Form variables: variables that are the same for all forms, including:
[ELEMENT_NAME] - Element name
[form_id] - Form ID
[form_name] - Form Name
[form_url] - Form Url
[submission_id] - Submission ID
[submission_date] - Submission Date
[submission_content] - Submission Content
[submit_from_page] - Submit from Page
[submission_count] - Submission Count
Example: In the email notification settings for admin of a form named "Contact Us", you insert the variable [form_name] in the "Email Subject" field. When a customer submits the form, the admin will receive an email in which the subject will be "Contact Us".
- Element variables: variables that are decided by the elements that each form has.
Example: if a form has phone number element, this form has [phone] variable. But in another form, there is no phone number element, so this form doesn't have [phone] variable.
Frequently Asked Questions
Yes, you can insert variables in other email fields, not just email body:
- For admin: you can add variables in Sender Name, Sender Email, Reply to and Email Subject.
- For customer: you can insert variables in Email Subject.
Blog & Resources
Start Building Smarter Magento 2 Forms
Create and Publish Forms in Minutes... What are you waiting for?