Is it possible to change a metafield type from Integer to Text?

Solved
markdc
Excursionist
18 0 9

We have an Integer metafield for products which already contains values. It no longer needs to validate as an integer. Can I change it to Single Line Text? I don't want to recreate the metafield to avoid having to re-enter all the information.

Accepted Solution (1)

Accepted Solutions
stratify
Shopify Staff
14 1 7

This is an accepted solution.

Hey @markdc – Strat here from Shopify

We don't yet provide the ability to edit metafield definitions. That said, you can delete an existing definition (without deleting the metafields!) and create a new definition over the existing namespace and key. You can do that in the Settings > Metafields section of the Admin:

  1. Open the definition that you'd like to change.
  2. Delete the definition but do not delete the metafields – you'll see a popup modal with some options when you try to delete the definition.
  3. Now go to the "Metafields without a definition" tab in your settings. You should see a list item for your metafields under the existing namespace and key.
  4. Select "Add a definition" for the existing metafields.
  5. You can select any definition type that you want, including text.

Updating metafields from integer to text should be a seamless process. If you're changing definitions that don't overlap – for example, going from JSON metafields to integer – you will see a warning to migrate your metafield values after creating a new definition. I hope that's helpful!

View solution in original post

Reply 1 (1)
stratify
Shopify Staff
14 1 7

This is an accepted solution.

Hey @markdc – Strat here from Shopify

We don't yet provide the ability to edit metafield definitions. That said, you can delete an existing definition (without deleting the metafields!) and create a new definition over the existing namespace and key. You can do that in the Settings > Metafields section of the Admin:

  1. Open the definition that you'd like to change.
  2. Delete the definition but do not delete the metafields – you'll see a popup modal with some options when you try to delete the definition.
  3. Now go to the "Metafields without a definition" tab in your settings. You should see a list item for your metafields under the existing namespace and key.
  4. Select "Add a definition" for the existing metafields.
  5. You can select any definition type that you want, including text.

Updating metafields from integer to text should be a seamless process. If you're changing definitions that don't overlap – for example, going from JSON metafields to integer – you will see a warning to migrate your metafield values after creating a new definition. I hope that's helpful!

View solution in original post