Send customers to a product page after registration

Topic summary

A user is attempting to redirect customers to a specific product page (/products/healthy-box) after registration on their Shopify store.

Current Implementation:

  • Added a hidden input field with name="return_to" in the customers/register.liquid template
  • The redirect works, but bypasses Shopify’s built-in validation

Core Problem:

  • Registration form redirects even when validation fails (e.g., passwords under 5 characters, duplicate emails, invalid email formats)
  • Backend doesn’t create customer records when validation errors occur, but users are still redirected to the product page
  • This creates a poor user experience as customers don’t see error messages

Status:
The issue remains unresolved. A support member initially reported everything working fine after checking the store (www.ohmysnacks.net), but the original poster clarified the validation bypass problem persists. The discussion needs a solution that maintains Shopify’s form validation while enabling conditional redirect only upon successful registration.

Summarized with AI on November 22. AI used: claude-sonnet-4-5-20250929.

Hello.

Simple doubt but I don’t find the solution

After customer registration I want to send him to my product page. I have one solution, but my solution don’t work because don’t check registation error, for example, password with less than 5 characters or check if customers already exist.

My solution: I change customers/register.liquid and add to the code

input type="hidden" name="return_to" value="/products/healthy-box"/
<section
  class="customer login page"
  data-section-id="{{ section.id }}"
  data-section-type="register"
>
  <div class="login__inner page__inner">
    <header style="margin-bottom:40px;" class="login__header page__header">
      <h1 class="login__heading article__heading ff-heading fs-heading-2-large fs-heading-1-base-ns ta-c">{{ 'customer.register.title' | t }}</h1>
    </header>

    <div class="login__main">

      {%- assign formId = 'RegisterForm' -%}
      {% form 'create_customer', id: formId, novalidate: 'novalidate' %}

      **<input type="hidden" name="return_to" value="/products/healthy-box"/>**

      
        {%- assign success_msg = 'customer.register.success' | t -%}
        {%- render 'form-status', form: form, form_id: formId, success_message: success_msg -%}

        <label for="{{ formId }}-FirstName" class="visually-hidden">{{ 'customer.register.first_name' | t }}</label>
        <input
          type="text"
          name="customer[first_name]"
          placeholder="{{ 'customer.register.first_name' | t }}"
          id="{{ formId }}-FirstName"
          class="input"
          {% if form.first_name %}value="{{ form.first_name }}"{% endif %}
          autocomplete="given-name"
        >

        <label for="{{ formId }}-LastName" class="visually-hidden">{{ 'customer.register.last_name' | t }}</label>
        <input
          type="text"
          name="customer[last_name]"
          placeholder="{{ 'customer.register.last_name' | t }}"
          id="{{ formId }}-LastName"
          class="input"
          {% if form.last_name %}value="{{ form.last_name }}"{% endif %}
          autocomplete="family-name"
        >

        <label for="{{ formId }}-email" class="visually-hidden">{{ 'customer.register.email' | t }}</label>
        <input
          type="email"
          name="customer[email]"
          placeholder="{{ 'customer.register.email' | t }}"
          id="{{ formId }}-email"
          class="input {% if form.errors contains 'email' %} input--error{% endif %}"
          {% if form.email %} value="{{ form.email }}"{% endif %}
          autocorrect="off"
          autocapitalize="off"
          autocomplete="email"
          aria-required="true"
          {%- if form.errors contains 'email' -%}
            class="input--error"
            aria-invalid="true"
            aria-describedby="{{ formId }}-email-error"
          {%- endif -%}
        >

        <label for="{{ formId }}-password" class="visually-hidden">{{ 'customer.register.password' | t }}</label>
        <input
          type="password"
          name="customer[password]"
          placeholder="{{ 'customer.register.password' | t }}"
          id="{{ formId }}-password"
          class="input {% if form.errors contains 'password' %} input--error{% endif %}"
          aria-required="true"
          {%- if form.errors contains 'password' -%}
            class="input--error"
            aria-invalid="true"
            aria-describedby="{{ formId }}-password-error"
          {%- endif -%}
        >
      
        <input
          type="submit"
          class="btn btn--primary btn--medium"
          value="{{ 'customer.register.submit' | t }}"
        >

      {% endform %}
    </div>
  </div>
</section>

I try another solution, add this code after

{% endform %}
{% if form.posted_successfully? %}

{% assign redirect_url = '/products/healthy-box

'%}
<script>
window.location.href = '{{ redirect_url }}';
</script>

{% endif %}

but this redirect to my homepage !?! why? :confounded_face:

Thanks for your time and help,

Ricardo

@Kardu

Could you please share your store URL (with pass if enabled),

So i can check and provide best solution to you !

Hello.

My store is www.ohmysnacks.net

thanks :slightly_smiling_face:

@Kardu

I check your issue,but i can’t find any problem.

Everythis is working fine.

It’s not working well. Try to register where you only put a password with two characters. Shopify will not give an error and will move to the product page.

In fact, on the back end there was no record. And you can’t, since the word pass doesn’t have 5 letters.

My problem is that it is forwarding but it is not doing the necessary validations as if the password is valid, if the email already exists in the database and if the email is valid

shopify is not validating password and email.