cancel
Showing results for 
Search instead for 
Did you mean: 

2.4.2 - Add Name fields to default Newsletter form

2.4.2 - Add Name fields to default Newsletter form

Hi Folks.  New site on Magento 2.4.2 using the Porto theme v4.0.3.

 

I want to use the Newsletter popup to have customers sign up and create an account. However, I need to ensure that they supply First and Last Name (2 fields) in addition to their email. 

 

I've been unsuccessful in finding where the default Magento newsletter configuration (ideally) or template exists so I can add those fields to it. Configuring the text and background image of the popup (except the form) is in Stores -> Configuration -> Porto -> Porto Settings Panel in the Newsletter section, if that helps.

 

MANY thanks!

1 REPLY 1

Re: 2.4.2 - Add Name fields to default Newsletter form

  1. Create a module with registration.php, module.xml files.
  2. Override the subscribe.phtml template in your module.
  3. Copy the content from the core template and add new input fields for first name and last name.
  4. Extend the newsletter subscriber model in di.xml.
  5. In your extended model class, update the logic to save the new first name and last name data.
  6. Clear caches and test the new fields in the newsletter subscription form.

The key steps are overriding the template to display the new fields, extending the subscriber model to capture the data, and updating the model's save logic.