Save a checkout field to an order metafield
In short
In the input block, set Where to store the value to Metafield and enter a Namespace and Key like custom.po_number. Then create a matching order metafield definition in Shopify with cart-to-order copying on, or the value won't reach the order.
✓ Applies to
- Text Input, Dropdown, Date Picker, Phone Input, Gift Message and Dependency Dropdown (Combined mode)
- Text Input fields nested in a Conditional Checkbox
- Advanced and Deluxe plans
✕ Doesn't apply to
- The Checkbox block, which doesn't save its value
- Dependency Dropdown in Separate mode, which always saves attributes
Attribute or metafield?
Not sure? Use Attribute. It needs no setup.
| Attribute | Metafield | |
|---|---|---|
| Set in the block | Name of the attribute, e.g. po_number | Namespace and Key, e.g. custom.po_number |
| Reaches the order | Always | Only with a matching definition |
| Shows on the order | Additional details | Metafields |
| Setup in Shopify | None | An order metafield definition |
Works with Text Input, Dropdown, Date Picker, Phone Input, Gift Message and Dependency Dropdown (Combined mode). Not the Checkbox block.
Steps for a metafield
Choose Metafield
Open your block and click the input block. Under Where to store the value, choose Metafield.
Name it
In Namespace and Key, type something like custom.delivery_date. Lower case, numbers and underscores, with one dot. Click Done, then Save.
Add the definition in Shopify
In Shopify, go to Settings → Metafields and metaobjects → Orders. Add a definition with the same namespace and key, type Single line text.
Turn on cart-to-order copying
Enable cart-to-order copying on the definition and save. Without it, Shopify doesn’t copy the value to the order.
Checkout Ninja doesn’t create the definition for you. Can’t turn on copying? Use Attribute instead.
Check it works
Place a test order. Open it in Orders and scroll to Metafields. Your value is there.
Good to know
- Values are always saved as single line text, even dates.
- Only key, no dot? It saves to
custom.<key>. - Apple Pay and Google Pay don’t apply cart metafields. Attributes are safer if many buyers use them.
- Blank attribute name? Text Input and Dropdown use the Label. Date Picker and Phone Input have no fallback, so always name them.
Not working?
- No value on the order: check the namespace and key match and copying is on. Then place a new test order.
- Saved under
custom.default_key: you used more than one dot. Usenamespace.key. - Can’t find it: attributes are under Additional details, not Metafields.
Frequently asked
Should I use an attribute or a metafield? +
Use an attribute unless you have a reason not to. Attributes reach the order with no setup and show under Additional details. Choose a metafield when a tool you use reads order metafields, or you want a typed field on the order.
What namespace is used if I only enter a key? +
custom. Entering po_number saves to custom.po_number. Use exactly one dot to set your own namespace, such as ops.po_number.
What type should the order metafield definition be? +
Single line text. Checkout Ninja writes every value as a single_line_text_field.
Why is my metafield value missing from the order? +
Usually because no order metafield definition exists with the same namespace and key, or cart-to-order copying isn't enabled on it. Shopify only copies the cart metafield to the order when both are true.