Goal: capture a “client number” from a storefront registration form and save it to a Shopify customer metafield (custom data field), rather than notes or tags.
Attempts to write directly to customer metafields from the storefront failed; Shopify support provided no technical guidance. Some services suggested using the customer note field instead.
Interim workaround: store values as customer tags (labels on the customer). For multiple inputs, concatenate values into one string and submit via a hidden field to customer[tags]. A sample code pattern was shared. Users report tags can be read by apps; one uses them with a custom app, and another plans to test with Klaviyo.
Key update:
A developer confirms: out-of-the-box, Shopify cannot create/update metafields from the storefront (frontend).
Proposed solution: use the FieldsRaven app to create/update metafields from the storefront, including on the customer resource. Supports text, numbers, and JSON types. Examples show collecting custom customer attributes, customer registration with custom fields, and syncing data to Klaviyo; requires comfort with code.
Status: No native solution. Workarounds are tags or third-party apps; discussion remains open awaiting native support.
I really like the new metafields that Shopify introduced last year. However I’m having problems storing values from frontend forms to these metafields.
What I want to achieve is this:
Adding a client number field to my registration form and storing it in a previously added metafield on the customer.
I achieved storing the number as a client note, but I would prefere to store it as a metafield. So I generated a new metafield through the settings: customer.metafields.my_fields.number
But I couldn’t figure out the correct way to store the users input to this new metafield. I tried a lot of things similar to the following code.
But no matter what I tried, the value was never stored in the metafield. What am I doing wrong? I also did a lot of reasearch but couldn’t find any reference on how to store front end input values to metafields. I am greatful for any help.
No, unfortunately not. I’ve also contacted Shopify support but they don’t give technical advice. Besides that I have not invested more time in solving it, as it is not yet urgent for me. However there must be a way to accomplish it. I really like the new meta fields but not being able to store user input in them seems to be strange. So let’s hope someone comes up with a solution.
I’m now storing all the needed values as tags. It works, but somehow it’s a pity as meta fields would be the cleaner solution. However, if you are interested in my tag-based solution, let me know.
This is something I’ve been wanting to achieve as well. Shopify support wasn’t able to assist me either and unfortunately the only solution that HeyCarson could offer for me was via the customer note field you mentioned which we also already utilize.
Following along here in hopes someone else has an idea.
Sorry, I thought that I wrote a reply some days ago. Obviously I haven’t …
I couldn’t figure out how to store input data in meta fields. However I can help you storing these data as tags. Do you want to store one or several input fields as tags?
So if you wan’t to store multiple values, you can not only assign them seperately, because then you’re overwriting existing tags and only the last value gets stored. That’s why you have to join all the values in one string and then assign it to the customer[tags].
Here is an example how I did it. Maybe there are better solutions. But so far it works for me.
// Create input fields for desired tags. Change "variableX" to your liking.
// Script to join the values in one string.
// Hidden field to store string of joint values
// On submit, execute the script above and assign the value to the hidden field
Thank you for this. I’m trying to solve the same issue using metafields. Helium Customer Fields gets close to doing what I need, but then I don’t like that their boxes don’t close like the address fields does. Bonify Custom Fields also gets close by using metafields, but then the input function is lost and users can’t enter the data.
Claudio, are the tags still working for you? Any limitations on getting the data to be read by other apps like Klaviyo?
Sorry for my late reply. So yes, tags still work for me. I don’t use them with Klaviyo or similar apps but with a custom app which relies on those tags and it works fine. So I guess every app that can deal with tags should be able to access this information and work with it.
Thanks. I have email flows that rely on that data intergration. I’ll play with tags and see how it goes. I may have to have an app built for what I want ##- Please type your reply above
Out of the box it’s not possible to create/update metafields from the storefront.
However last year I built a niche app (FieldsRaven) for theme developers to make it possible.
Your use case is perfect fit for the app, if you’re comfortable working with code it should be really simple, otherwise you’ll need some dev help. Here is the quick start guide.
Hi Karim! Sounds amazing! Will this work if I want to create a form with fields tied to custom metafields on customer profiles? your demo shop wasn’t really working for me, so I had a hard time understanding what the app can do thanks!
Great question. All of the apps seem to deal with everything except the customer profile where it makes the most sense when trying to expand the customer profile. My challenge is allowing the customer a way to edit their own custom data inside of their own profile, then have it read by Klaviyo or Omnisend. My research continues…
FieldsRaven is perfect for allowing the customer a way to edit their own custom data inside of their own profile and syncing some or all of the data with Klaviyo – assuming that you’re comfortable enough with code.