How can I add a new field in customer registration on Shopify?

Solved

How can I add a new field in customer registration on Shopify?

sivainguva
Tourist
29 0 1

Hi All, I am pretty new to the shopify. We are running a website which is integrated to the shopify. So when ever a customer registers an account from our website it posts all the customer data to the shopify using the POST API call. so i added a new field to our registration page called company_name but shopify doesnot have this field so how can i implement this.

Accepted Solution (1)
Kyle_W
Shopify Partner
179 28 115

This is an accepted solution.

Alright thanks a lot, Also in one of our store CUSTOM BRANDED BOXES, the price for one of the product keeps changing frequently even if we dint change it any idea?

@sivainguva without more details it's difficult to determine what the culprit could be.

I suggest marking this current thread as "Solved" to let others know that you found a solution for company name. If you are still needing assistance with the product price issue, you can create another thread with more details on the problem you're reporting and perhaps someone else here on the forums can jump in and provide some assistance. Of course you can always contact Shopify's support team directly as well.

Kyle W | Helium
Helium builds apps that thousands of merchants depend on:
- Customer Fields ✪✪✪✪✪ (350+ reviews)
- Meteor Mega Menu ✪✪✪✪✪ (250+ reviews)

View solution in original post

Replies 22 (22)

Bitfresh
Shopify Partner
57 10 12

Hi sivainguva,

You can save it into the address.company (see https://shopify.dev/docs/themes/liquid/reference/objects/address). Or you can store it into a metafield (Read more here: https://shopify.dev/docs/admin-api/rest/reference/metafield). It depends on what option you should choose, if you also collect address information on signup you can use the first option, else I would recommend the customer metafield.

sivainguva
Tourist
29 0 1

Hey That sounds good, just a quick question, so where does that show up in shopify if i add metafield ?

Bitfresh
Shopify Partner
57 10 12

Hi sivainguva,

Metafields are not shown inside the Shopify Admin. There are some browser plugins to edit and show metafields (Like this one: https://chrome.google.com/webstore/detail/poshify-utilities/albldpmnhhhcjiladaacehfabibgbllk). Or you can request the metafields resource for a specific customer: /admin/customers/#{id}/metafields.json. To show the metafield on you website you can use liquid, for example if you save the company name in the customer object you can show it on their account page with: {{ customer.metafields.company.name }}.

sivainguva
Tourist
29 0 1

Actually we have a application on shopify , but we wanted the company name information to be displayed on shopify where we see the firstname, email,....etc. So when a user registers through our website the customer object was sent to shopify as well where we add the metafields and send it to shopify. but we wanted the companyname to be displayed on shopify admin.

sivainguva
Tourist
29 0 1

Also if we add the Metafields in customer.json, willit appear in shopify admin.
https://shopify.dev/docs/admin-api/rest/reference/customers/customer#index-2021-04

Kyle_W
Shopify Partner
179 28 115

Hey @sivainguva!

As @Bitfresh has mentioned, metafield data is not shown directly in the Shopify Admin UI. If you want the company name to appear in the Shopify admin, then you'll need to save this data into address.company and/or customer.note. The data for the "Customer Note" field will show in the Shopify admin on the customer list page, customer detail page, and order detail page. See the screenshot below for an example:

 customer note example.png

Kyle W | Helium
Helium builds apps that thousands of merchants depend on:
- Customer Fields ✪✪✪✪✪ (350+ reviews)
- Meteor Mega Menu ✪✪✪✪✪ (250+ reviews)
sivainguva
Tourist
29 0 1

Hey Kyle,

 

That sounds good, just one more question lets say we asking customers the complete address during they signup with our website. I use thee address.companyName to get the data to the shopify. In this scenario where would you see this address on the shopify admin.

Kyle_W
Shopify Partner
179 28 115

Hey @sivainguva!

You can view a customer's address details in the Shopify admin on several different pages. Here's an example of where to find the data in question when viewing an individual customer record (the company name is highlighted in yellow):

Image 2021-07-08 at 4.43.00 PM-down.jpg 

Kyle W | Helium
Helium builds apps that thousands of merchants depend on:
- Customer Fields ✪✪✪✪✪ (350+ reviews)
- Meteor Mega Menu ✪✪✪✪✪ (250+ reviews)
sivainguva
Tourist
29 0 1

Hey Kyle,

Thanks for response , So we are having the address forms in 2 pages during the sign up we have the address fields and during the checkout as well we have address fields . So in this scenario what happens to the address they enter during the checkout?

sivainguva
Tourist
29 0 1

Hey Kyle, 

 

Please help me on this.

Kyle_W
Shopify Partner
179 28 115

Hey @sivainguva!

So we are having the address forms in 2 pages during the sign up we have the address fields and during the checkout as well we have address fields . So in this scenario what happens to the address they enter during the checkout?

When a logged-in customer proceeds to the checkout process on Shopify, the address fields will be prefilled with the customer's default address. If the customer record does not have a default address, or if a new address is supplied during the checkout process, then the Shopify will update the customer record once the order is placed, and the address collected during checkout will be saved as the customer's default address.

Does this help to answer your question?

Kyle W | Helium
Helium builds apps that thousands of merchants depend on:
- Customer Fields ✪✪✪✪✪ (350+ reviews)
- Meteor Mega Menu ✪✪✪✪✪ (250+ reviews)
sivainguva
Tourist
29 0 1

Thanks that helps.

sivainguva
Tourist
29 0 1

Hey Kyle, 

 

Just a quick question, As i told we are asking the customers their address during the account creation on our website , by looking at this api document , i wonder how would i get the customerid , during the account creation ?
https://shopify.dev/api/admin/rest/reference/customers/customer-address#create-2021-07

Kyle_W
Shopify Partner
179 28 115

@sivainguva 

When you create a customer record via API, Shopify will include the auto-generated customer ID in the response: https://shopify.dev/api/admin/rest/reference/customers/customer#create-2021-01. You would then need to reference this customer ID when making another call to the Customer Address resource to create a customer's address. Note that you can also define an address when creating a customer record, thus eliminating the need to make a separate call.

Kyle W | Helium
Helium builds apps that thousands of merchants depend on:
- Customer Fields ✪✪✪✪✪ (350+ reviews)
- Meteor Mega Menu ✪✪✪✪✪ (250+ reviews)
sivainguva
Tourist
29 0 1

Hey Kyle,

 

Thanks for response, Can we include the companyname in the address if we are trying to make single api call by adding address when creating the customer record?

sivainguva
Tourist
29 0 1

Hey Kyle,

 

Please let me know if you dint get my question.

Kyle_W
Shopify Partner
179 28 115

@sivainguva 

Can we include the companyname in the address if we are trying to make single api call by adding address when creating the customer record?

Yep, you sure can! 

 

Kyle W | Helium
Helium builds apps that thousands of merchants depend on:
- Customer Fields ✪✪✪✪✪ (350+ reviews)
- Meteor Mega Menu ✪✪✪✪✪ (250+ reviews)
sivainguva
Tourist
29 0 1

Hey Kyle,

 

Thanks a lot for the response , so now i am passing the address during the customer record creation. like this

{
  "customer": {
    "first_name": "Steve",
    "last_name": "Lastnameson",
    "email": "steve.lastnameson@example.com",
    "phone": "+15142546011",
    "verified_email": true,
    "addresses": [
      {
        "address1": "123 Oak St",
        "city": "Ottawa",
        "province": "ON",
        "phone": "555-1212",
        "zip": "123 ABC",
        "last_name": "Lastnameson",
        "first_name": "Mother",
"company_name": "Test",        "country": "CA"
      }
    ]
  }
}

So one last question if i do like  i will be able to see the address in shopify admin under the address column right?

Kyle_W
Shopify Partner
179 28 115

You're almost there, @sivainguva!

`company_name` is not valid property, so you'll need to use `company` instead, like so:

 

{
  "customer": {
    "first_name": "Steve",
    "last_name": "Lastnameson",
    "email": "steve.lastnameson@example.com",
    "phone": "+15142546011",
    "verified_email": true,
    "addresses": [
      {
        "address1": "123 Oak St",
        "city": "Ottawa",
        "province": "ON",
        "phone": "555-1212",
        "zip": "123 ABC",
        "last_name": "Lastnameson",
        "first_name": "Mother",
        "company": "Test Company",
        "country": "CA"
      }
    ]
  }
}

 

Kyle W | Helium
Helium builds apps that thousands of merchants depend on:
- Customer Fields ✪✪✪✪✪ (350+ reviews)
- Meteor Mega Menu ✪✪✪✪✪ (250+ reviews)
sivainguva
Tourist
29 0 1

Alright thanks a lot, Also in one of our store CUSTOM BRANDED BOXES, the price for one of the product keeps changing frequently even if we dint change it any idea?

Kyle_W
Shopify Partner
179 28 115

This is an accepted solution.

Alright thanks a lot, Also in one of our store CUSTOM BRANDED BOXES, the price for one of the product keeps changing frequently even if we dint change it any idea?

@sivainguva without more details it's difficult to determine what the culprit could be.

I suggest marking this current thread as "Solved" to let others know that you found a solution for company name. If you are still needing assistance with the product price issue, you can create another thread with more details on the problem you're reporting and perhaps someone else here on the forums can jump in and provide some assistance. Of course you can always contact Shopify's support team directly as well.

Kyle W | Helium
Helium builds apps that thousands of merchants depend on:
- Customer Fields ✪✪✪✪✪ (350+ reviews)
- Meteor Mega Menu ✪✪✪✪✪ (250+ reviews)

UmarFarooq
Shopify Partner
2 0 1

Hi All,

Is there any way to create a company in Shopify through Admin API, If have can you send it here?
Thank You! 
PREVIEW