Magento2: Overriding the Customer Registration Form Template
Why the hell isn't Magento2 loading the template file that I want it to!? I followed the same override process as all of the other templates I've changed!
This issue has been fixed in Magento 2.1.x.
Issue originally found on EE version 2.0.5., post below in tact for reference
So, I created an override file for the Customer Registration template and placed it where it should automatically pull from my version. I copied
and made my changes. Easy enough, right? That process has worked with every other template I’ve overridden
Well, it doesn’t work.
But I need it to work! I did the exact same thing with every other template file I have edited thus far, so what gives? My OCD needs to move that email field to the signin area and bump those buttons at the end of the form up underneath the other section of the form.
The fix is pretty easy, as it just seems like an oversight in the
Magento_Customer module. You’ll also have to override the layout file associated with the customer registration.
1. Copy the layout file to your theme.
Copy the customer account creation layout xml file below
to the theme that you’re editing
2. Line 14 looks off.
That template attribute value doesn’t seem to give with the rest of them.
<block class="Magento\Customer\Block\Form\Register" name="customer_form_register" template="form/register.phtml">
3. Add the proper location call to the template attribute.
All of the other attributes are referencing the module that the template is applying to. Add
Magento_Customer:: to the template path, making line 14:
<block class="Magento\Customer\Block\Form\Register" name="customer_form_register" template="Magento_Customer::/form/register.phtml">
4. Save, reload, and you’re good to go!
You should now see that Magento is using the template file you want it to, instead of continuing to fall back to the vendor default.
Have you found any other code oversignts in your Magento2 projects? Share them below!