# customer-metafields-editor

> Form that prefills and saves the customer's custom metafields; 2.0: once saved, the customer is read again and the form comes back 5 s after its success message.

Status: Ready (Smootify 2.0)  
URL: https://www.smootify.io/docs/astro/reference/elements/customer-metafields-editor  
Updated: 2026-10-21

## Where it can go

- **Anywhere** on the page.
- **Must contain** `form`.
- **Out of place,** Smootify removes it from the page: no form.

## What it requires

- Shopify’s **customer accounts**, and `newCustomerAccountsPublicKey` in [`SmootifyUserOptions`](https://www.smootify.io/docs/astro/reference/options).

## Fields in the form

Each field’s `name` attribute tells Smootify what the field holds.

| Name | Field | What it does |
|---|---|---|
| any name: the metafield key | `input type="text"`, `textarea`, `select`, `input type="radio"`, `input type="checkbox"`, `file-input` | Saves the customer metafield `custom.<key>`, the key being the snake_case of `data-name` (the `name` as written without it), and is prefilled from it, select and textarea included; a lone checkbox saves `true` checked and `false` unchecked; names starting with `_` are not saved, and a repeated name keeps its last value. 2.0: a field sent empty (a text cleared, the last file removed from a `file-input`) empties its metafield (deleted: Shopify takes no empty value); a field a condition hides is left alone. |

## Loading

Its code loads only on pages that have `customer-metafields-editor`.
