All things Shopify and commerce
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
I have added a phone number field in user registration field but its not saving data anywhere. I need to show that data in user's profile in phone field.
Note: I have tried saving the phone number in note field but need to integrate into the profile phone field.
Here is my code:
<div class="field">
<label for="customerPhone">Phone Number</label>
<input
type="tel"
id="customerPhone"
name="customer[phone]"
spellcheck="false"
autocapitalize="off"
autocomplete="phone"
aria-required="true"
placeholder="Mobile Number"
{% if form.errors contains 'phone' %}
aria-invalid="true"
aria-describedby="RegisterForm-phone-error"
{% endif %}
{% if customer.phone %}
value="{{ customer.phone }}"
{% endif %}
required
>
<label for="RegisterForm-phone"> Mobile Number </label>
</div>
{%- if form.errors contains 'phone' -%}
<span id="RegisterForm-phone-error" class="form__message">
<svg aria-hidden="true" focusable="false">
<use href="#icon-error" />
</svg>
{{ form.errors.translated_fields.phone | capitalize }}
{{ form.errors.messages.phone }}.
</span>
{%- endif -%}
Try Metafields instead.
You can try to get that data to be stored on a metafield and then use that metafield on the customers/account.liquid page to show them that number.