Creating a customer from the 'customer' form.

Shopify Partner
1 0 1

If you look in most themes there is a template for a newsletter subscription. It will have something like this: 

{% form 'customer' %}
      {{ form.errors | default_errors }}
      {% if form.posted_successfully? %}
        <p class="note form-success">{{ 'general.newsletter_form.confirmation' | t }}</p>
      {% else %}
        <input type="hidden" name="contact[tags]" value="newsletter">
        <input type="email" value="{% if customer %}{{ }}{% endif %}" placeholder="{{ 'general.newsletter_form.newsletter_email' | t }}" name="contact[email]" id="Email" class="input-group-field" aria-label="{{ 'general.newsletter_form.newsletter_email' | t }}" autocorrect="off" autocapitalize="off">
        <input type="submit" class="btn" name="subscribe" id="subscribe" value="{{ 'general.newsletter_form.submit' | t }}">
      {% endif %}
    {% endform %}

This allows you to create a 'customer', where only the email is set. I am attempting to utilize this functionality for a giveaway my store is running. However, I want to also allow customers to provide a name and opt-in for future marketing. By default, this newsletter form sets it. 


I have tried a million things and cannot get my form to set the [accepts_marketing] field to false. No matter what it is always true. I have seen several forums where people have had success implementing this on the 'create_customer' form that is found on customer/registration.liquid. 


Here is my most recent attempt, but I have tried several others, does anyone know if this is just simply blocked by the 'customer' form and there is no overriding it? 

{% form 'customer' %}

      {{ form.errors | default_errors }}
      {% if form.posted_successfully? %}
        <p class="note form-success">Thank you for participating in our contest!</p>
      {% else %}

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

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

      <label for="Email" class="label--hidden">{{ '' | t }}</label>
      <input type="email" name="contact[email]" id="Email" placeholder="{{ '' | t }}" {% if form.errors contains "email" %} class="error"{% elsif %} value="{{ }}"{% endif %} autocorrect="off" autocapitalize="off">

      <label for="CreateTags" class="label--hidden">Tags</label>
      <input type="hidden" name="contact[tags]" id="CreateTag2" value="This Contest Only">
      <div id="accept" class="clearfix inputrow">
        <label for="accepts_marketing" class="login">Mailing List?</label>
        <input type="hidden" name="contact[accepts_marketing]" value="false" />
        <input type="checkbox" name="contact[accepts_marketing]" id="accepts_marketing" class="{% if form.errors contains 'email' %} error{% endif %}" value="true" checked />
      Subscribe to stay updated with new products and offers!

        <input type="submit" value="Enter Contest" class="btn" style="width:100%;text-transform:uppercase;">
		{% endif %}
    {% endform %}

Any help would be extremely welcome! Thank you.

1 Like
Shopify Partner
108 3 19


I had a similar request for a customer.

In the end, I built a private app to set that flag back in Shopify. 

Hope it helps!


Bogdan | WebShopAssist
User friendly apps with top-rated support
- SKUGen the SKU generator
- DPD Integration
Shopify Partner
1 0 0

How I can add phone number field? I tried but it won't be displayed on customer detail. Can you please help me

21 0 5

Hi @joannakimberlyw 


Did you ever get this solved? I don't think 'write an app' is an appropriate solution as its total overkill for just storing a value against a customer record. I've been trawling the forums to understand how to create key:value pairs from a for. There were some posts on `customer[note]` but i couldn't get sufficient documentation on it to get it working.



1 Like
Shopify Partner
105 4 43

If this is still relevant, something like might do the trick.


There are actually quite a few different way of going about this, so it that's a no go then reply here and we'll go from there.

Building custom, public-facing Shopify Apps for various niches. Ping me with your app ideas!

My Apps:
* Countries We Ship To Button (Free!) - Show your customers where you ship to with a crisp button + pop-up!

My Tutorials:
* Get Notified When New Comments Are Added To Your Shopify Blog (Free!) - A quick & easy tutorial to set up a free web-service that e-mails you when you get a new comment on your Shopify blog!