Magento 2 Contact Us grid | Contact Us Rest API | Contact Us Graph QL

Contact_Us

Contact Us This is the most underrated section on most of the frameworks, and Magento is not behind in it either. Do you know where the Contact Us details are stored in Magento?

    Hello Everyone! This is MO😉. In the blog, I am going to explain how to configure and use our Contact Us module on Magento 2.

Introduction

Magento does not store the contact details in it. Our module helps you capture and store the Contact Us form details in the Magento database. The Contact Us form mainly has four fields: name, email, telephone number, and comment or message.

Download our extension, Magento_ContactUs, from GitHub.

Configurations

Go to store > settings > configurations > General > Contacts > Contact Us > Set "yes" to enable Contact Us, followed by "yes" to display the Contact Us grid, so the Contact Us menu will be visible under the Marketing > User Content Section.

Config_yes

grid_enable

If the Display Contact Us Grid is set to "no," the grid won’t be visible on the backend, but the data will be stored in the database.

config_no

grid_disable

Pay Load 

Disclaimer: All the payloads are sample payloads.

Magento Luma theme form submission

We have submitted the Contact Us form from the Luma theme with the following input:

Name: Mohith

Email: mohithdeveloper@gmail.com

Phone number: 9876543211

What’s on your mind?: Sample Comment from Luma Theme

luma

luma_success
grid_luma

Magento Rest API

Disclaimer: I will usually use V2 ( version two) for custom endpoints.

We have submitted the Contact Us form from Post Man via the REST API.

Endpoint: {base_url}/rest/V2/contactus

Request type: POST

Parameters:

contactForm[name]                  Mohith

contactForm[email]                   mohithdeveloper@gmail.com

contactForm[telephone]            9876543211

contactForm[comment]             SampleComment-From Rest Api

restapi

restapi_success
grid_restapi

If you are looking to know more about the Rest API Post method check out our blog Mastering Magento 2 Rest API POST Method: The Ultimate Guide.

Magento Graph QL

We have submitted the Contact Us form from ChromeiQL via Graph QL( we have used Mutation for form submission).

Payload:

 mutation {
   contactus(
     input:{
        name: "Mohith"
        email: "mohithdeveloper@gmail.com"
        telephone: "9876543211"
        comment: "SampleComment-From Graph QL"       
     }
   ){
       msg
   }
 }

graphql

grid_graphql

Conclusion:

Our module works seamlessly with the Magento Luma theme, Rest API, and Graph QL.

FAQ’s 

How do I enable your module? 

Download the module from GitHub, paste the module code into your code directory, and run the bin/magento module:enable Mohith_ContactUs, followed by the deployment comments.

If you still have doubts about module creation check out our blog Magento 2 Module Creation.

Where are the contact details stored?

Contact Us details are stored in the Magento database in the table “magento_contact_us”.

Does it work with all the Magento default contact forms?

All Magento default contact forms work with it.

Thank you for Reading. Are you fascinated to know more about Magento? What are you waiting for? Check out the other blogs in the Magento section and other Magento Plugins. Follow us on YouTube, Github, and Instagram to know more about us. Always happy to hear from you. The Code improvement and Module Enhancement are Appreciated. For any Magento 2 projects or Magento 2 freelancing, contact me at "mohithdeveloper@gmail.com".

Post a Comment

0 Comments