I need to create State and Country attribute for customer registration and Admin.
How can I Achieving State and Country field functionality in Admin under customer Account Information
State and country should already be listed under Customers -> {Any Customer} -> Addresses in the Admin panel.
On the registration form however, I have noticed Magento has no setting to enable address form on the customer registration page. In vendor/magento/module-customer/view/frontend/templates/form/register.phtml
on line 45, you can see there is an if statement wrapped around your address form.
<?php if ($block->getShowAddressFields()): ?>
<fieldset class="fieldset address">
<legend class="legend"><span><?= $block->escapeHtml(__('Address Information')) ?></span></legend><br>
<input type="hidden" name="create_address" value="1" />
...
<input type="hidden" name="default_billing" value="1">
<input type="hidden" name="default_shipping" value="1">
</fieldset>
<?php endif; ?>
Copy this template to your own theme and you can either remove the if statement or set the condition to true.