diff --git a/app/code/Magento/Customer/Block/Form/Register.php b/app/code/Magento/Customer/Block/Form/Register.php
index d6d0d9c494c11..1a8efa9a872ae 100644
--- a/app/code/Magento/Customer/Block/Form/Register.php
+++ b/app/code/Magento/Customer/Block/Form/Register.php
@@ -7,6 +7,7 @@
use Magento\Customer\Helper\Address;
use Magento\Customer\Model\AccountManagement;
+use Magento\Directory\Block\Data;
use Magento\Framework\App\ObjectManager;
use Magento\Newsletter\Model\Config;
@@ -17,8 +18,10 @@
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @since 100.0.2
*/
-class Register extends \Magento\Directory\Block\Data
+class Register extends Data
{
+ private const XML_PATH_SHOW_ADDRESS_FIELDS = 'customer/address/show_address_fields';
+
/**
* @var \Magento\Customer\Model\Session
*/
@@ -228,4 +231,19 @@ public function getRequiredCharacterClassesNumber()
{
return $this->_scopeConfig->getValue(AccountManagement::XML_PATH_REQUIRED_CHARACTER_CLASSES_NUMBER);
}
+
+ /**
+ * Returns whether to show address fields or not
+ *
+ * @return bool
+ */
+ public function isShowAddressFields(): bool
+ {
+ $result = false;
+ if ($this->getShowAddressFields() || $this->getConfig(self::XML_PATH_SHOW_ADDRESS_FIELDS)) {
+ $result = true;
+ }
+
+ return $result;
+ }
}
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCustomerCreateAccountWithAdditionalInformationActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCustomerCreateAccountWithAdditionalInformationActionGroup.xml
new file mode 100644
index 0000000000000..048174b951465
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCustomerCreateAccountWithAdditionalInformationActionGroup.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+ EXTENDS: SignUpNewUserFromStorefrontActionGroup. Fills prefix, suffix, DOB, VAT number, gender, company, telephone, fax, address fields.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerConfigSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerConfigSection.xml
index f8a441e40a792..d9ea04c9f702b 100644
--- a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerConfigSection.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerConfigSection.xml
@@ -13,5 +13,6 @@
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerCreateFormSection/StorefrontCustomerCreateFormSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerCreateFormSection/StorefrontCustomerCreateFormSection.xml
index 6b65ef861472c..c063177438870 100644
--- a/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerCreateFormSection/StorefrontCustomerCreateFormSection.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerCreateFormSection/StorefrontCustomerCreateFormSection.xml
@@ -8,10 +8,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCreateCustomerWithAdditionalInformationTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCreateCustomerWithAdditionalInformationTest.xml
new file mode 100644
index 0000000000000..6b8f936448be0
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCreateCustomerWithAdditionalInformationTest.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/etc/adminhtml/system.xml b/app/code/Magento/Customer/etc/adminhtml/system.xml
index 569f9d09c2087..c06a55a61ad37 100644
--- a/app/code/Magento/Customer/etc/adminhtml/system.xml
+++ b/app/code/Magento/Customer/etc/adminhtml/system.xml
@@ -247,6 +247,13 @@
Magento\Config\Model\Config\Source\Nooptreq
Magento\Customer\Model\Config\Backend\Show\Customer
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+ Enables address information fields on the registration form.
+
+
Magento\Config\Model\Config\Source\Nooptreq
diff --git a/app/code/Magento/Customer/etc/config.xml b/app/code/Magento/Customer/etc/config.xml
index ab2020580a2eb..34e04a883e86c 100644
--- a/app/code/Magento/Customer/etc/config.xml
+++ b/app/code/Magento/Customer/etc/config.xml
@@ -55,6 +55,7 @@
+ 0
req
opt
diff --git a/app/code/Magento/Customer/i18n/en_US.csv b/app/code/Magento/Customer/i18n/en_US.csv
index 0a81e70964b4c..8450c61dca931 100644
--- a/app/code/Magento/Customer/i18n/en_US.csv
+++ b/app/code/Magento/Customer/i18n/en_US.csv
@@ -543,3 +543,5 @@ Addresses,Addresses
"The Store View selected for sending Welcome email from is not related to the customer's associated website.","The Store View selected for sending Welcome email from is not related to the customer's associated website."
"Add/Update Address","Add/Update Address"
"The specified customer group id does not exist.","The specified customer group id does not exist."
+"Show Address Information","Show Address Information"
+"Enables address information fields on the registration form.","Enables address information fields on the registration form."
diff --git a/app/code/Magento/Customer/view/frontend/templates/form/register.phtml b/app/code/Magento/Customer/view/frontend/templates/form/register.phtml
index 5e58f94683ec1..c354591dab1e2 100644
--- a/app/code/Magento/Customer/view/frontend/templates/form/register.phtml
+++ b/app/code/Magento/Customer/view/frontend/templates/form/register.phtml
@@ -69,7 +69,7 @@ $formData = $block->getFormData();
= $block->getChildHtml('fieldset_create_info_additional') ?>
- getShowAddressFields()): ?>
+ isShowAddressFields()): ?>
getAttributeValidationClass('city'); ?>
getAttributeValidationClass('postcode'); ?>
getAttributeValidationClass('region'); ?>
@@ -320,11 +320,11 @@ $scriptString .= <<