{"id":20481,"date":"2020-02-25T16:45:18","date_gmt":"2020-02-25T14:45:18","guid":{"rendered":"https:\/\/belvg.com\/blog\/?p=20481"},"modified":"2021-02-18T09:19:00","modified_gmt":"2021-02-18T07:19:00","slug":"how-to-add-custom-fields-into-a-contact-form-in-magento-2","status":"publish","type":"post","link":"https:\/\/belvg.com\/blog\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html","title":{"rendered":"How to Add Custom Fields to Magento 2 Contact Form"},"content":{"rendered":"\n<p>Communication with customers is the key to gaining their loyalty. You have to be patient, positive and responsive. We have already discussed hundreds of ways and places where you can reach out to the customers. But what is the most efficient way for the customers to reach out to you? Discover contact page advantages!<\/p>\n<p><!--more--><\/p>\n<p>There is a great variety of different tools like chatbots, emails, social networks and others. In this article, we decided to pay attention to contact forms and present a ready-made guide to empower your Magento website. Read the article to find out how to add custom fields to a contact form and get some useful tips for your business.<\/p>\n<p><strong>Table of contents:<\/strong><\/p>\n<p><a href=\"#step_1\">What is a Contact Page and Why do You Need It?<br>\n<\/a><a href=\"#step_2\">Why is Contact Page Important for SEO?<br>\n<\/a><a href=\"#step_3\">Top Contact Form Tips<br>\n<\/a><a href=\"#step_4\">Best Contact Us Page Examples<br>\n<\/a><a href=\"#step_5\">How to Add Custom Fields to Magento Contact Form<\/a><\/p>\n<p>There is a great variety of different tools like chatbots, emails, social networks and others. In this article, we decided to pay attention to contact forms and present a ready-made guide to empower your Magento website. Read the article to find out how to add custom fields to a contact form and get some useful tips for your business.<\/p>\n<h2 id=\"step_1\">What is a Contact Page and Why do You Need It?<\/h2>\n<p>First, you should ask yourself a question &ndash; <strong>do I even need a contact page<\/strong>? A contact us page contains a form which allows website visitors to contact its owner or a support team depending on whose email it is connected to. The contact form consists of the fields where visitors can enter a name, email to let the support team contact them back and a subject matter with a message.<\/p>\n<p>You may wonder why to create a separate contact page as the users could directly reach out to you using email or phone number mentioned on the website as well. Why do business owners opt for contact pages? Here are several reasons <strong>why<\/strong>:<\/p>\n<ul>\n<li><strong>Contact page protects your website from spam.<\/strong> Imagine that you want to communicate with the audience, so you put an email somewhere on your website. This way spammers get access to your inbox and they are likely to load it with spam emails. If you don&rsquo;t want to spend hours looking for a relevant message, use the contact form to get in touch with your customers.<\/li>\n<li><strong>Contact page helps to track website visitors.<\/strong> You just need to set conversion goals to the contact form and track the number of visitors on your contact page. Moreover, you can track from where your visitors enter the contact page and define the most popular way. Using a contact form, you can develop a strategy to convert your visitors into loyal customers.<\/li>\n<li><strong>Contact page increases conversions.<\/strong> How? If for any reason, your website visitor encounters a problem, a contact page is a feature you need to prevent them from leaving directly. They come across a contact form and start a conversation looking for the solution they need.<\/li>\n<li><strong>Contact page gives your website a professional look.<\/strong> A website without a contact form will look incomplete or show that you don&rsquo;t know how to run an online business. Adding it to the website, you will appear more professional to the visitors. Moreover, potential business partners are more likely to contact you via the form rather than an email address.<\/li>\n<\/ul>\n<div class=\"module_in_content_container\"><a href=\"https:\/\/belvg.com\/web-design\" class=\"link_to_module\" target=\"_blank\" rel=\"noopener\"><\/a><div class=\"module_content\"><img src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2015\/11\/Web-Design.png\" width=\"360\" height=\"360\" alt=\"Web Design\" class=\"module_image\" title=\"How to Add Custom Fields to Magento 2 Contact Form\"><div class=\"module_content_part\"><h3 class=\"title\">Web Design<\/h3><p class=\"module_content_text\">Build bright ecommerce future with brightminded web designers<\/p><a href=\"https:\/\/belvg.com\/web-design\" class=\"link_2_to_module\" target=\"_blank\" style=\"display:inline-block\" rel=\"noopener\"><span class=\"read-more\">Visit the page<\/span><\/a><\/div><\/div><\/div>\n<h2 id=\"step_2\">Why is Contact Page Important for SEO?<\/h2>\n<p>Contact pages are needed not only to communicate with customers but they can do more for your website. A contact form is one of the pages on your website that can rank in searches. But the majority of companies do not include keywords on their contact pages losing a SEO opportunity.<\/p>\n<p>However, a contact us page does not have many possible places where you can add keywords. As an alternative, many merchants use additional tags at the HTML of web pages. Regular website users won&rsquo;t pay attention to these trick but, as you know, search engines have a limited understanding of the page content. Making pages with Microdata, you will help Google and other search engines understand what kind of information is given, where the location is, what the price is and even more. As a result, your contact form ranks higher in searches and drives traffic.<\/p>\n<div class=\"module_in_content_container\"><a href=\"https:\/\/belvg.com\/magento-custom-development\" class=\"link_to_module\" target=\"_blank\" rel=\"noopener\"><\/a><div class=\"module_content\"><img src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/01\/magento-custom-development.png\" width=\"120\" height=\"120\" alt=\"magento custom development\" class=\"module_image\" title=\"How to Add Custom Fields to Magento 2 Contact Form\"><div class=\"module_content_part\"><h3 class=\"title\">Magento Custom Development<\/h3><p class=\"module_content_text\">Take your online store to the next level with BelVG Magento Custom Development <\/p><a href=\"https:\/\/belvg.com\/magento-custom-development\" class=\"link_2_to_module\" target=\"_blank\" style=\"display:inline-block\" rel=\"noopener\"><span class=\"read-more\">Visit the page<\/span><\/a><\/div><\/div><\/div>\n<h2 id=\"step_3\">Top Contact Form Tips<\/h2>\n<p>Before creating a contact form for your website, you need to have a clear vision of it. And here there are also some rules that you need to follow or your visitors won&rsquo;t click the Submit button. We have plenty of experience in creating contact forms for our customers as well as using them ourselves &ndash; so here is a list of working tips for you.<\/p>\n<ul>\n<li><strong>Simplify as much as possible. <\/strong>Do not use lots or fields, colors and details &ndash; anything that can divert or irritate users. They don&rsquo;t need to feel that the company tries to let people give up and contact it in any case. Making it simple, people will contact you because they want to.<\/li>\n<li><strong>Use common phrasing.<\/strong> Have you ever seen proper contact forms with huge and over creative phrases? Definitely not. Keep following the idea of simplicity &ndash; use classic phrases like Help, Contact Us, Get Support that are easy to understand for everyone.<\/li>\n<li><strong>Avoid confusing Call to actions and put them in common places.<\/strong> We recommend following strategies of the majority of companies &ndash; use footer and header links for the contact page and don&rsquo;t put it anywhere else on the page. But if it doesn&rsquo;t fit your design, you can try to find your own way. However, make sure to keep it understandable.<\/li>\n<li><strong>Make your form mobile friendly.<\/strong> Hardly all your visitors use desktops with the same dimensions. If your contact form is not mobile-friendly, you risk losing a number of customers who can&rsquo;t contact you from smartphones or tablets. Make your contact form mobile friendly to show customers that you care about their experience.<\/li>\n<li><strong>Avoid long dropdown menu options.<\/strong> If you decide to use dropdown menus in your contact form, remember that users hate long ones. No one is searching for their date of birth for hours. Users just leave the page tired of the menu &ndash; let them enter the information without any difficulties.<\/li>\n<li><strong>Use only simple captchas.<\/strong> All business owners will agree that captcha is a must to filter spam and avoid email issues. But despite this, captcha has a negative effect on conversions of websites. Trying to protect your website from spammers, don&rsquo;t use complex captchas with lots of verification stages or you risk losing customers in future.<\/li>\n<li><strong>Send a personalized message after the form is sent.<\/strong> Many merchants create ready-made message forms to respond to customers. But when people want to communicate with a brand via the contact form, they expect to see a personal interest of a support team. Sending personalized messages, you have more chances to build strong relationships with users.<\/li>\n<\/ul>\n<h2 id=\"step_4\">Best Contact Us Page Examples<\/h2>\n<p>A well-designed customer contact form can enhance the customer experience. Every business is different with unique products and services as well as customers and their personal requirements. But all such pages have something in common what you can see on the following contact page examples and include in your online contact form.<\/p>\n<h3>Basecamp<\/h3>\n<p><a href=\"https:\/\/basecamp.com\/support\" rel=\"noopener\" target=\"_blank\">Basecamp<\/a> is a software company based in Chicago. It creates web applications such as Campfire, Backpack and Highrise, open source web app Ruby on Rails as well as Basecamp software package.<\/p>\n<p>The company&rsquo;s contact page design is an example of not only fascinating but also functional form. Basecamp wants to create close relationships with customers and prove that they care about them introducing the support team members to users. Their contact page has links to their <a href=\"https:\/\/belvg.com\/blog\/how-to-create-faq-page.html\" rel=\"noopener\" target=\"_blank\">FAQ page<\/a> and guides for users. Instead of a bold subject field, Basecamp offers to choose among the most frequent problems. Then you only need to fill out the message, email and URL address fields and add a screenshot or document, if necessary.<\/p>\n<p><a href=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2015\/11\/basecamp-contact-us.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2015\/11\/basecamp-contact-us.jpg\" alt=\"basecamp contact page\" width=\"1154\" height=\"767\" class=\"lazy aligncenter size-full wp-image-25813\" title=\"How to Add Custom Fields to Magento 2 Contact Form\"><\/a><\/p>\n<h3>Monin<\/h3>\n<p>Monin is a producer of syrups, toppings and sauces from France. The company was founded in 1912 and turned into a leading brand of the drinks industry. If you visit different restaurants and clubs, you might have seen Monin drinks among other ingredients at the bar.<\/p>\n<p>The contact page of the company is an example of a classic form that was made in the same style as the whole website. <a href=\"https:\/\/belvg.com\/work\/monin\" rel=\"noopener\" target=\"_blank\">Monin<\/a> contact form contains the most common fields where you need to enter your name, email address, subject of your issue and the message.<\/p>\n<p><a href=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2015\/11\/monin-contact-page.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2015\/11\/monin-contact-page.jpg\" alt=\"monin contact page\" width=\"1260\" height=\"585\" class=\"lazy aligncenter size-full wp-image-25806\" title=\"How to Add Custom Fields to Magento 2 Contact Form\"><\/a><\/p>\n<h3>Yummygum<\/h3>\n<p>Yummygum is a design studio from Amsterdam, the Netherlands. They focus on user interfaces as well as web, IOS and native apps icons. The company, unlike the above mentioned, offers a two-step process to contact their support team.<\/p>\n<p>When you click on Contact on <a href=\"https:\/\/yummygum.com\/contact\" rel=\"noopener\" target=\"_blank\">Yummygum<\/a> website, you can pick the style of conversation: formal, meeting for coffee and informal. According to your choice, you will see different contact forms. Choosing Your great project, you need to fill out name, company, email address, budget and explain the idea as well as pick timeframe and project type. Clicking on Meeting for coffee of Birds and bees, you see a simple form with name, email and a message.<\/p>\n<p><a href=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2015\/11\/yummygum-contact-page.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2015\/11\/yummygum-contact-page.jpg\" alt=\"yummygym contact page\" width=\"1573\" height=\"829\" class=\"lazy aligncenter size-full wp-image-25805\" title=\"How to Add Custom Fields to Magento 2 Contact Form\"><\/a><\/p>\n<h3>Dior<\/h3>\n<p>Dior is a French luxury <a href=\"https:\/\/en.wikipedia.org\/wiki\/Dior\" rel=\"noopener\" target=\"_blank\">brand<\/a> founded in 1946. The company designs and retails fashion accessories, leather goods, footwear, clothes, makeup and skincare. The company has over 200 brick and mortar stores worldwide as well as sells goods online on their website.<\/p>\n<p>Dior is a brand that doesn&rsquo;t focus on a specific product. Having a huge number of goods, the company has to divide their contact pages according to it. For example, on their contact <a href=\"https:\/\/www.dior.com\/en_int\/contact-choice\" rel=\"noopener\" target=\"_blank\">page<\/a> you can pick among Christian Dior Couture and Parfums Christian Dior. Choosing the first one, you appear on a detailed contact page. There you see their working hours and need to fill out your title, name, location, number, email address and only then enter your subject and explain the issue. Below, you can start an online chat, call the support team, make an appointment with an advisor in store and visit their FAQ page.<\/p>\n<p>Are you inspired? As you have seen, a contact page is not a boring list of your phone numbers and addresses. When you want the page to work on your brand, you need to generate creative ideas and make it unique.<\/p>\n<p><a href=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2015\/11\/dior-contact-us.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2015\/11\/dior-contact-us.jpg\" alt=\"dior contact page\" width=\"1142\" height=\"905\" class=\"lazy aligncenter size-full wp-image-25814\" title=\"How to Add Custom Fields to Magento 2 Contact Form\"><\/a><\/p>\n<h2 id=\"step_5\">How to Add Custom Fields to Magento 2 Contact Form<\/h2>\n<p>Want to add a contact form to your Magento store? Instead of using a ready-made one, create custom contact fields for your website. It allows to create different combinations of fields to collect the right set of information about your customers. So, how can you do it?<\/p>\n<p>To create a form according to your needs, default Magento 2 functionality might not be enough. There are several ways to extend its functionality.<\/p>\n<p>Firstly, you can use modules or create your own. For example, let&rsquo;s create the BelVG Contact module:<\/p>\n<p><a href=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/03\/How-to-add-custom-fields-to-contact-form-magento.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/03\/How-to-add-custom-fields-to-contact-form-magento.png\" alt=\"How-to-add-custom-fields-to-contact-form-magento\" width=\"566\" height=\"550\" class=\"lazy aligncenter size-full wp-image-25816\" title=\"How to Add Custom Fields to Magento 2 Contact Form\"><\/a><\/p>\n<p>Create <strong>form.phtml template<\/strong> and add there an <strong>enctype=&rdquo;multipart\/form-data&rdquo; attribute<\/strong> and new fields for department and file uploading.<\/p>\n<p>&hellip;<label class=\"label\" for=\"department\"><label class=\"label\" for=\"department\"><\/label><\/label>&hellip;<\/p>\n<pre class=\"lang:default decode:true \">&lt;div class=\"field department required\"&gt;\r\n   &lt;label class=\"label\" for=\"department\"&gt;\r\n&lt;span&gt;&lt;?=block-&gt;escapeHtml(__(Department)) ?&gt;&lt;\/span&gt;\r\n&lt;\/label&gt;\r\n   &lt;div class=\"control\"&gt;\r\n       &lt;select name=\"department\" required&gt;\r\n           &lt;option disabled selected hidden value=\"\"&gt;&lt;?= $block-&gt;escapeHtml(__('Select a department')) ?&gt;&lt;\/option&gt;\r\n           &lt;option&gt;&lt;?= $block-&gt;escapeHtml(__('Tech dept')) ?&gt;&lt;\/option&gt;\r\n           &lt;option&gt;&lt;?= $block-&gt;escapeHtml(__('Marketing dept')) ?&gt;&lt;\/option&gt;\r\n       &lt;\/select&gt;\r\n   &lt;\/div&gt;\r\n&lt;\/div&gt;\r\n<\/pre>\n<pre class=\"lang:default decode:true \">&lt;div class=\"field file\"&gt;\r\n   &lt;label class=\"label\" for=\"file\"&gt;&lt;span&gt;&lt;?= $block-&gt;escapeHtml(__('Attach a file')) ?&gt;&lt;\/span&gt;&lt;\/label&gt;\r\n   &lt;div class=\"control\"&gt;\r\n       &lt;input name=\"MAX_FILE_SIZE\" type=\"hidden\" value=\"2000000\" \/&gt;\r\n       &lt;input type=\"file\" name=\"file\" id=\"file\"&gt;\r\n   &lt;\/div&gt;\r\n&lt;\/div&gt;\r\n<\/pre>\n<p>Add information to choose the working hours of a store (which are configured in the admin panel).<\/p>\n<pre class=\"lang:default decode:true \">&lt;div class=\"field note no-label\"&gt;&lt;?= $block-&gt;escapeHtml(__('Our working hours: '))?&gt;&lt;\/div&gt;<\/pre>\n<p>We also need to enter data on the working hours. Use <b>WorkingHours.php<\/b> for that.<\/p>\n<pre class=\"lang:default decode:true \">public function getWorkingHours($store = null)\r\n{\r\n   if (!$store) {\r\n       $store = $this-&gt;storeManager-&gt;getStore();\r\n   }\r\n   return $this-&gt;scopeConfig-&gt;getValue(\r\n       \\Magento\\Store\\Model\\Information::XML_PATH_STORE_INFO_HOURS,\r\n       \\Magento\\Store\\Model\\ScopeInterface::SCOPE_STORE,\r\n       $store\r\n   );\r\n}\r\n<\/pre>\n<p>Enter in the <strong>Hours<\/strong> template the following:<\/p>\n<p><code>$this-&gt;helper(BelVG\\Contact\\Helper\\WorkingHours::class)-&gt;getWorkingHours()<\/code><\/p>\n<p>But this template is not connected instead of a standard one. To do this, add <strong>contact_index_index.xml<\/strong>.<\/p>\n<pre class=\"lang:default decode:true \">      &lt;referenceBlock name=\"contactForm\" remove=\"true\"\/&gt;\r\n       &lt;referenceContainer name=\"content\"&gt;\r\n           &lt;block class=\"Magento\\Contact\\Block\\ContactForm\" name=\"customContactForm\" template=\"BelVG_Contact::form.phtml\"\/&gt;\r\n       &lt;\/referenceContainer&gt;\r\n<\/pre>\n<p>Now on a website, you can see something like this:<\/p>\n<p><a href=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/03\/contact-page-in-magento-2.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/03\/contact-page-in-magento-2.png\" alt=\"contact page in magento 2\" width=\"946\" height=\"718\" class=\"lazy aligncenter size-full wp-image-25817\" title=\"How to Add Custom Fields to Magento 2 Contact Form\"><\/a><\/p>\n<p>Then, we need to create an <strong>email<\/strong> template.<\/p>\n<p><a href=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/03\/contact-form-in-magento-2.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/03\/contact-form-in-magento-2.png\" alt=\"contact form in magento 2\" width=\"370\" height=\"687\" class=\"lazy aligncenter size-full wp-image-25818\" title=\"How to Add Custom Fields to Magento 2 Contact Form\"><\/a><\/p>\n<p><a href=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/03\/How-to-add-contact-form-to-magento-2.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/03\/How-to-add-contact-form-to-magento-2.png\" alt=\"How to add contact form to magento 2\" width=\"1026\" height=\"490\" class=\"lazy aligncenter size-full wp-image-25819\" title=\"How to Add Custom Fields to Magento 2 Contact Form\"><\/a><\/p>\n<p>In the template, you should apply the field to the selected department.<\/p>\n<pre class=\"lang:default decode:true \">&lt;tr&gt;\r\n    \t&lt;td&gt;&lt;b&gt;{{trans \"Department\"}}&lt;\/b&gt;&lt;\/td&gt;\r\n    \t&lt;td&gt;{{var data.department}}&lt;\/td&gt;\r\n&lt;\/tr&gt;\r\n<\/pre>\n<p>And then you should apply the new field.<\/p>\n<p><a href=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/03\/contacts-configuration.png\"><img decoding=\"async\" loading=\"lazy\" class=\"lazy aligncenter size-full wp-image-20486\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/03\/contacts-configuration.png\" alt=\"Apply the template to the contact form\" width=\"977\" height=\"504\" title=\"How to Add Custom Fields to Magento 2 Contact Form\"><\/a><\/p>\n<div class=\"field department required\">\n<p><span style=\"font-weight: 400;\">After sending the message, you get the following:&nbsp;<\/span><\/p>\n<p><a href=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/03\/how-to-manage-contact-form-in-magento-2.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/03\/how-to-manage-contact-form-in-magento-2.png\" alt=\"how to manage contact form in magento 2\" width=\"710\" height=\"196\" class=\"lazy aligncenter size-full wp-image-25820\" title=\"How to Add Custom Fields to Magento 2 Contact Form\"><\/a><\/p>\n<\/div>\n<p>To process the file, we need to add <strong>Block<\/strong>, <strong>Model<\/strong> and <strong>Controller<\/strong>:<\/p>\n<p><a href=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/03\/how-to-use-contact-form-in-magento.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/03\/how-to-use-contact-form-in-magento.png\" alt=\"how to use contact form in magento\" width=\"489\" height=\"499\" class=\"lazy aligncenter size-full wp-image-25821\" title=\"How to Add Custom Fields to Magento 2 Contact Form\"><\/a><\/p>\n<div class=\"field department required\">\n<p>In the <strong>Block<\/strong> we create:<\/p>\n<pre class=\"lang:default decode:true \">public function getFormAction()\r\n{\r\n   return $this-&gt;getUrl('custom_contact\/index\/post', ['_secure' =&gt; true]);\r\n}\r\n \r\npublic function getWorkingHours($store = null)\r\n{\r\n   if (!$store) {\r\n       $store = $this-&gt;storeManager-&gt;getStore();\r\n   }\r\n   $storeInformation = $this-&gt;information-&gt;getStoreInformationObject($store);\r\n   return $storeInformation-&gt;getData('hours');\r\n}\r\n<\/pre>\n<p>In the <strong>Controller<\/strong>:<\/p>\n<pre class=\"lang:default decode:true \">public function execute()\r\n{\r\n   if (!$this-&gt;getRequest()-&gt;isPost()) {\r\n       return $this-&gt;resultRedirectFactory-&gt;create()-&gt;setPath('*\/*\/');\r\n   }\r\n   try {\r\n       $this-&gt;sendEmail($this-&gt;validatedParams());\r\n       $this-&gt;messageManager-&gt;addSuccessMessage(\r\n           __('Thanks for contacting us with your comments and questions. We\\'ll respond to you very soon.')\r\n       );\r\n       $this-&gt;dataPersistor-&gt;clear('contact_us');\r\n   } catch (LocalizedException $e) {\r\n       $this-&gt;messageManager-&gt;addErrorMessage($e-&gt;getMessage());\r\n       $this-&gt;dataPersistor-&gt;set('contact_us', $this-&gt;getRequest()-&gt;getParams());\r\n   } catch (\\Exception $e) {\r\n       $this-&gt;logger-&gt;critical($e);\r\n       $this-&gt;messageManager-&gt;addErrorMessage(\r\n           __('An error occurred while processing your form. Please try again later.')\r\n       );\r\n       $this-&gt;dataPersistor-&gt;set('contact_us', $this-&gt;getRequest()-&gt;getParams());\r\n   }\r\n   return $this-&gt;resultRedirectFactory-&gt;create()-&gt;setPath('contact\/index');\r\n}\r\n \r\n\/**\r\n* @param array $post Post data from contact form\r\n* @return void\r\n*\/\r\nprivate function sendEmail($post)\r\n{\r\n   $this-&gt;customMail-&gt;send(\r\n       $post['params']['email'],\r\n       ['data' =&gt; new DataObject($post['params']), 'file' =&gt; $post['file']]\r\n   );\r\n}\r\n \r\n\/**\r\n* @return array\r\n* @throws \\Exception\r\n*\/\r\nprivate function validatedParams()\r\n{\r\n   $request = $this-&gt;getRequest();\r\n   if (trim($request-&gt;getParam('name')) === '') {\r\n       throw new LocalizedException(__('Enter the Name and try again.'));\r\n   }\r\n   if (trim($request-&gt;getParam('comment')) === '') {\r\n       throw new LocalizedException(__('Enter the comment and try again.'));\r\n   }\r\n   if (false === \\strpos($request-&gt;getParam('email'), '@')) {\r\n       throw new LocalizedException(__('The email address is invalid. Verify the email address and try again.'));\r\n   }\r\n   if (trim($request-&gt;getParam('hideit')) !== '') {\r\n       throw new \\Exception();\r\n   }\r\n   $result = ['params' =&gt; $request-&gt;getParams(), 'file' =&gt; []];\r\n \r\n   $filesData = $this-&gt;getRequest()-&gt;getFiles('file');\r\n   if(isset($filesData['name'])) {\r\n       try {\r\n           $data = $this-&gt;getAttachFileData();\r\n       }  catch (\\Exception $e) {\r\n           throw new LocalizedException(__('Attached file error.'));\r\n       }\r\n       $result['file'] = $data;\r\n   }\r\n \r\n   return $result;\r\n}\r\n \r\nprivate function getAttachFileData()\r\n{\r\n   $uploader = $this-&gt;fileUploaderFactory-&gt;create(['fileId' =&gt; 'file']);\r\n   $uploader-&gt;setAllowRenameFiles(true);\r\n   $uploader-&gt;setFilesDispersion(true);\r\n   $uploader-&gt;setAllowCreateFolders(true);\r\n   $path = $this-&gt;fileSystem-&gt;getDirectoryRead(DirectoryList::MEDIA)-&gt;getAbsolutePath('contact-file');\r\n   $result = $uploader-&gt;save($path);\r\n   $filePath = $result['path'].$result['file'];\r\n   $fileName = $result['name'];\r\n   return ['path' =&gt; $filePath, 'name' =&gt; $fileName];\r\n}\r\n<\/pre>\n<p>In the <strong>Model<\/strong>:<\/p>\n<\/div>\n<pre class=\"lang:default decode:true \">public function send($replyTo, array $variables)\r\n{\r\n   \/** @see \\Magento\\Contact\\Controller\\Index\\Post::validatedParams() *\/\r\n   $replyToName = !empty($variables['data']['name']) ? $variables['data']['name'] : null;\r\n   $fileData = !empty($variables['file']) ? $variables['file'] : [];\r\n \r\n   $this-&gt;inlineTranslation-&gt;suspend();\r\n   try {\r\n       $transport = $this-&gt;transportBuilder\r\n           -&gt;setTemplateIdentifier($this-&gt;contactsConfig-&gt;emailTemplate())\r\n           -&gt;setTemplateOptions(\r\n               [\r\n                   'area' =&gt; Area::AREA_FRONTEND,\r\n                   'store' =&gt; $this-&gt;storeManager-&gt;getStore()-&gt;getId()\r\n               ]\r\n           )\r\n           -&gt;setTemplateVars($variables)\r\n           -&gt;setFrom($this-&gt;contactsConfig-&gt;emailSender())\r\n           -&gt;addTo($this-&gt;contactsConfig-&gt;emailRecipient())\r\n           -&gt;setReplyTo($replyTo, $replyToName);\r\n       if(!empty($fileData)) {\r\n           $transport-&gt;addAttachment($fileData['path'], $fileData['name']);\r\n       }\r\n       $transport-&gt;getTransport()-&gt;sendMessage();\r\n   } finally {\r\n       $this-&gt;inlineTranslation-&gt;resume();\r\n   }\r\n}\r\n<\/pre>\n<p>Now you receive a file as an attachment in the message.<\/p>\n<div class=\"field department required\">\n<h2>Wrapping it up<\/h2>\n<p>If you consider upgrading your Magento contact form or still don&rsquo;t have it at all, keep our tips and guides in mind. Follow our detailed instruction to add custom fields in your Magento online store and get ideas from the best examples of contact us forms that we have listed above. If you look for more information on how to empower your website, check our blog.<\/p>\n<p>Like the article? Share your thoughts in the comments below and check out our contact page.<\/p>\n<p><em>The following people contributed to the article: Aleksander Kutseika, Diana Zevan.<\/em><\/p>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"Communication with customers is the key to gaining their loyalty. You have to be patient, &#8230;","protected":false},"author":82,"featured_media":20517,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"image","meta":{"_acf_changed":false,"footnotes":""},"categories":[491,389,469,524,526],"tags":[],"class_list":["post-20481","post","type-post","status-publish","format-image","has-post-thumbnail","hentry","category-magento-2","category-magento2-development","category-magento2-tutorial","category-magento-speed-optimization","category-magento-theme","post_format-post-format-image"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"Learn to add custom fields to Magento 2 contact form. Find out why you need a contact page and get useful tips on how to make it right\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Andrey Litvin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/belvg.com\/blog\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#article\",\"name\":\"How to Add Custom Fields to Magento 2 Contact Form | BelVG Blog\",\"headline\":\"How to Add Custom Fields to Magento 2 Contact Form\",\"author\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/andrey-litvin#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/How-to-Add-Custom-Fields-into-a-Contact-Form-in-Magento-2.jpg\",\"width\":1110,\"height\":590,\"caption\":\"How to Add Custom Fields into a Contact Form in Magento 2\"},\"datePublished\":\"2020-02-25T16:45:18+02:00\",\"dateModified\":\"2021-02-18T09:19:00+02:00\",\"inLanguage\":\"en-US\",\"commentCount\":8,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#webpage\"},\"articleSection\":\"Magento 2, Magento 2 Development, Magento 2 Tutorial, Magento Speed Optimization, Magento Theme, Image\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento2-development#listItem\",\"name\":\"Magento 2 Development\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento2-development#listItem\",\"position\":2,\"name\":\"Magento 2 Development\",\"item\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento2-development\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#listItem\",\"name\":\"How to Add Custom Fields to Magento 2 Contact Form\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#listItem\",\"position\":3,\"name\":\"How to Add Custom Fields to Magento 2 Contact Form\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento2-development#listItem\",\"name\":\"Magento 2 Development\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\",\"name\":\"BelVG Blog\",\"description\":\"Magento and Prestashop articles\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/andrey-litvin#author\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/andrey-litvin\",\"name\":\"Andrey Litvin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e1a6e3c80cb940fddb65016d94b015cd951b4a8a9cd7227565131f28ea95c7a0?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Andrey Litvin\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#webpage\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html\",\"name\":\"How to Add Custom Fields to Magento 2 Contact Form | BelVG Blog\",\"description\":\"Learn to add custom fields to Magento 2 contact form. Find out why you need a contact page and get useful tips on how to make it right\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/andrey-litvin#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/andrey-litvin#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/How-to-Add-Custom-Fields-into-a-Contact-Form-in-Magento-2.jpg\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html\\\/#mainImage\",\"width\":1110,\"height\":590,\"caption\":\"How to Add Custom Fields into a Contact Form in Magento 2\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#mainImage\"},\"datePublished\":\"2020-02-25T16:45:18+02:00\",\"dateModified\":\"2021-02-18T09:19:00+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\",\"name\":\"BelVG Blog\",\"description\":\"Magento and Prestashop articles\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"How to Add Custom Fields to Magento 2 Contact Form | BelVG Blog","description":"Learn to add custom fields to Magento 2 contact form. Find out why you need a contact page and get useful tips on how to make it right","canonical_url":"https:\/\/belvg.com\/blog\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/belvg.com\/blog\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#article","name":"How to Add Custom Fields to Magento 2 Contact Form | BelVG Blog","headline":"How to Add Custom Fields to Magento 2 Contact Form","author":{"@id":"https:\/\/belvg.com\/blog\/author\/andrey-litvin#author"},"publisher":{"@id":"https:\/\/belvg.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/03\/How-to-Add-Custom-Fields-into-a-Contact-Form-in-Magento-2.jpg","width":1110,"height":590,"caption":"How to Add Custom Fields into a Contact Form in Magento 2"},"datePublished":"2020-02-25T16:45:18+02:00","dateModified":"2021-02-18T09:19:00+02:00","inLanguage":"en-US","commentCount":8,"mainEntityOfPage":{"@id":"https:\/\/belvg.com\/blog\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#webpage"},"isPartOf":{"@id":"https:\/\/belvg.com\/blog\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#webpage"},"articleSection":"Magento 2, Magento 2 Development, Magento 2 Tutorial, Magento Speed Optimization, Magento Theme, Image"},{"@type":"BreadcrumbList","@id":"https:\/\/belvg.com\/blog\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/#listItem","position":1,"name":"Home","item":"https:\/\/belvg.com\/blog\/","nextItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/magento2-development#listItem","name":"Magento 2 Development"}},{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/magento2-development#listItem","position":2,"name":"Magento 2 Development","item":"https:\/\/belvg.com\/blog\/category\/magento2-development","nextItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#listItem","name":"How to Add Custom Fields to Magento 2 Contact Form"},"previousItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#listItem","position":3,"name":"How to Add Custom Fields to Magento 2 Contact Form","previousItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/magento2-development#listItem","name":"Magento 2 Development"}}]},{"@type":"Organization","@id":"https:\/\/belvg.com\/blog\/#organization","name":"BelVG Blog","description":"Magento and Prestashop articles","url":"https:\/\/belvg.com\/blog\/"},{"@type":"Person","@id":"https:\/\/belvg.com\/blog\/author\/andrey-litvin#author","url":"https:\/\/belvg.com\/blog\/author\/andrey-litvin","name":"Andrey Litvin","image":{"@type":"ImageObject","@id":"https:\/\/belvg.com\/blog\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/e1a6e3c80cb940fddb65016d94b015cd951b4a8a9cd7227565131f28ea95c7a0?s=96&d=mm&r=g","width":96,"height":96,"caption":"Andrey Litvin"}},{"@type":"WebPage","@id":"https:\/\/belvg.com\/blog\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#webpage","url":"https:\/\/belvg.com\/blog\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html","name":"How to Add Custom Fields to Magento 2 Contact Form | BelVG Blog","description":"Learn to add custom fields to Magento 2 contact form. Find out why you need a contact page and get useful tips on how to make it right","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/belvg.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/belvg.com\/blog\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#breadcrumblist"},"author":{"@id":"https:\/\/belvg.com\/blog\/author\/andrey-litvin#author"},"creator":{"@id":"https:\/\/belvg.com\/blog\/author\/andrey-litvin#author"},"image":{"@type":"ImageObject","url":"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2019\/03\/How-to-Add-Custom-Fields-into-a-Contact-Form-in-Magento-2.jpg","@id":"https:\/\/belvg.com\/blog\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html\/#mainImage","width":1110,"height":590,"caption":"How to Add Custom Fields into a Contact Form in Magento 2"},"primaryImageOfPage":{"@id":"https:\/\/belvg.com\/blog\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html#mainImage"},"datePublished":"2020-02-25T16:45:18+02:00","dateModified":"2021-02-18T09:19:00+02:00"},{"@type":"WebSite","@id":"https:\/\/belvg.com\/blog\/#website","url":"https:\/\/belvg.com\/blog\/","name":"BelVG Blog","description":"Magento and Prestashop articles","inLanguage":"en-US","publisher":{"@id":"https:\/\/belvg.com\/blog\/#organization"}}]}},"aioseo_meta_data":{"post_id":"20481","title":"How to Add Custom Fields to Magento 2 Contact Form | #site_title","description":"Learn to add custom fields to Magento 2 contact form. Find out why you need a contact page and get useful tips on how to make it right","keywords":null,"keyphrases":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_custom_url":null,"og_image_custom_fields":null,"og_image_url":null,"og_image_width":null,"og_image_height":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_image_url":null,"twitter_title":null,"twitter_description":null,"schema_type":"default","schema_type_options":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null,"created":"2026-11-03 18:36:51","updated":"2026-11-03 18:36:51"},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/belvg.com\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/belvg.com\/blog\/category\/magento2-development\" title=\"Magento 2 Development\">Magento 2 Development<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHow to Add Custom Fields to Magento 2 Contact Form\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/belvg.com\/blog\/"},{"label":"Magento 2 Development","link":"https:\/\/belvg.com\/blog\/category\/magento2-development"},{"label":"How to Add Custom Fields to Magento 2 Contact Form","link":"https:\/\/belvg.com\/blog\/how-to-add-custom-fields-into-a-contact-form-in-magento-2.html"}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts\/20481","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/users\/82"}],"replies":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/comments?post=20481"}],"version-history":[{"count":25,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts\/20481\/revisions"}],"predecessor-version":[{"id":25865,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts\/20481\/revisions\/25865"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/media\/20517"}],"wp:attachment":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/media?parent=20481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/categories?post=20481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/tags?post=20481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}