Search code examples
registrationshopware6

Changing registration form in shopware 6 - initialCountryId / disable names for companies


I want to change the registration form a little bit. For example I want "Germany" to be preselected in the form. I took a look at the code and there is a field for it

{% block component_address_form_country_select %}
    {% set initialCountryId = 'c73fb8a7edd34096af700f45bb4872a3' %}
    {{parent()}}
{% endblock %}

I manually set the initalCountryId to Germany but this also should be possible from the admin backend or is this really the way to go? I also want to disable the fields name and surname for company registration, is this possible from the admin backend or do we need to change a twig file here as well?


Solution

  • You can define your default country on sales-channel level. It is then also preselected in the checkout and registration form. So I don't think your change is necessary.

    Regarding the surname and lastname, it's not possible to deactivate it by default, you need to provide them during registration. So there are two possibilities I guess:

    • Hiding it in the template and provide dummy data via the form(because they are a required fields)
    • Changing the registration validation via plugin