Collect Address On Registration?

Highlighted
Tourist
3 0 4

Is it possible to collect a customer's address as they register?

I have tried using a few variations of customer[addresses][0][address1] as the input name but with no success. New customers don't have any address data attached.

Thanks

3 Likes
Highlighted
Shopify Staff
Shopify Staff
207 0 10

Hello, Brandon here from the Shopify Guru Team :)

You can find the various address variables at this link and other customer variables at this link.  This should help you set up the collection of the customers address during registration.

Thanks for posting!

0 Likes
Highlighted
Tourist
3 0 4

Thanks for replying but I'm still unclear on how to format the name attributes of the address input fields. I know how they are referenced individually in Liquid from a customer object but not how to set them up in a registration form.

For example, here is my current registration form:

{% form 'create_customer' %}
  {{ form.errors | default_errors }}

  {% comment %} these address fields don't work {% endcomment %}
  <input type="text" name="customer[addresses_attributes][0][address1]" id="address1" />
  <input type="text" name="customer[addresses_attributes][0][city]" id="city" />
  <input type="text" name="customer[addresses_attributes][0][province]" id="province" />
  <input type="text" name="customer[addresses_attributes][0][zip]" id="zip" />
  <input type="text" name="customer[addresses_attributes][0][country]" id="country" />

  <input required type="email" name="customer[email]" id="email" placeholder="{{ 'customer.register.email' | t }}">
  <input required type="password" name="customer[password]" id="password" placeholder="{{ 'customer.register.password' | t }}">

  <input type="submit" value="Sign Up">
{% endform %}

I have tried a few variations of customer[address][...], customer[default_address][...], customer[addresses][0][...], etc etc.

(I saw an old thread that someone said they had success with [address_attributes], but later replies say it no longer works.)

But no matter what the values are not saved on the customer.

Maybe it's just not supported?

0 Likes
Highlighted
Tourist
3 0 4

Maybe a better question is: What parameters does the /account route accept for a POST?

I realize Shopify can't open source their controllers' code ;) -- but a whitelist of params would be helpful.

It's probably not a frequently used feature, but adding an address on registration would be a big win for us.

Thanks!

1 Like
Highlighted
Tourist
7 0 3

Did anyone get this to work?

0 Likes
Highlighted
Shopify Partner
1 0 0

I am using an app to create a customer with the additional address information, and send an email to admins when the account is created. 

the app can be found here, and it works great so I don't have to build this functionality.  https://apps.shopify.com/customr

If you want to build the form on your own with address information it looks like you can use the following lines of code, have not tested on my own. 

customer[addresses][][company]
customer[addresses][][address1]
customer[addresses][][address2]
customer[addresses][][city]
customer[addresses][][country]
customer[addresses][][province]
customer[addresses][][zip]
customer[addresses][][phone]

0 Likes
Highlighted
Tourist
10 0 5

Shopify has not answered this question? This is a very common use case.

  • Yes, there is an app.
  • No, we dont want to use it. 
  • Yes, we are Shopify Experts
  • Yes, this is a simple use case
  • Yes, this is a very common question
  • It seems no-one will answer this directly.
  1. Is it possible?
  2. If so, what are the exact "[name='xxxx']" attributes to use.

 

I am assuming Shopify is protecting App vendors here. They will have a market for people that want point and click. And if not, let the market decide if it is a good app. If its solving a real problem. If its in demand. And if none, of those - unfortunately, thats unlucky. Perhaps you just reinvented the wheel - or not.

 

unless bugs, we've tried:

customer[default_address][..]
customer[addresses_attributes][0][..]

 

2 Likes
Highlighted
Shopify Partner
5 0 0

I know this is old but I was trying to figure this out too and this thread confused me and made me try something that can't be done. I believe Shopify made a mistake in this thread by suggesting it is possible.

 

According to this link below you can't capture a customer's address inside the registration form. 

https://help.shopify.com/en/themes/customization/forms/get-more-information-with-customer-registrati...

 

So the link Shopify gave on this thread is misleading.

 

Also this thread says you can't get the address and mentions you can redirect them after they register to capture their address.

https://community.shopify.com/c/Shopify-Discussion/Capturing-user-address-on-account-creation/m-p/19...

 

 

0 Likes
Highlighted
New Member
1 0 0

A bit late for a reply but I was able to collect a single piece of information using customer[note].

You can also use customer[phone] and customer[tags] easily.

Take a look at the API docs and you can see what fields you can pass in

https://shopify.dev/docs/admin-api/rest/reference/customers/customer

 

Though it mentions customer[addresses], it seems to be a JSON array so might not be possible through a POST.

 

0 Likes