Prevent theme from adding a return URL to the registration page
Depending on how your theme is coded, it is possible that using the account link in the site header will add a return URL which will prevent the form's redirect settings from functioning. If this is happening, it will cause the URL to look like the following when navigating to the login or register pages:
To resolve this, you will need to edit the code that is being used for the account link.
Edit theme code
The first step for this will be to locate the actual code for the header account link. This will most commonly be found in the header.liquid
file in the theme code. It can vary depending on the theme, but there should be something that looks similar to the following:
{%- if shop.customer_accounts_enabled -%}
<a href="{{ routes.account_url }}" class="header__icon">
{% render 'icon-account' %}
</a>
{%- endif -%}
To resolve the problem here, we need to add an if statement to change the link based on if the customer is already logged in. You may need to tweak this to make everything match your theme's layout, but here is an example of the correct way this should look:
{%- if shop.customer_accounts_enabled -%}
<a href="{%- if customer -%}{{ routes.account_url }}{%- else -%}{{routes.account_login_url}}{%- endif -%}" class="header__icon ">
{% render 'icon-account' %}
</a>
{%- endif -%}
Make sure to save your changes, and always make sure to test on the storefront to make sure it works correctly now.
Questions or concerns?
Please reach out to our Support team via chat or email if you need any assistance π