Tags:
- Tools
Migrate metafields with shopify app import-custom-data-definitions
shopify app import-custom-data-definitionsshopify app import-custom-data-definitions is now available in Shopify CLI version 3.89.
This command helps you migrate existing metafield and metaobject definitions for your app to declarative TOML management. All app-owned definitions configured on your dev store are automatically converted to their TOML equivalent. These definitions include those with a namespace like $app or metaobjects with a type like $app:example, You can review the TOML definitions and add them to your shopify.app.toml file. You can continue writing metafield and metaobject values without any changes.
You can migrate all your definitions at once, or you can work step by step by running the command multiple times. Run shopify app dev to test your TOML definitions in your dev store, then run shopify app deploy to deploy your new centrally managed Metafield and Metaobject definitions to all shops with your app installed. After you've deployed your changes, you can delete the unnecessary definition management code.
Declarative definitions offer several advantages over API management:
- Shopify updates declared definitions in every shop where your app is installed, ensuring consistency across installations.
- Definitions stay in sync with your app's state, allowing you to roll out new metafields and related features simultaneously.
- Definitions are version controlled as part of your app, making it easy to roll back.
As always, feel free to reach out in the community forum to share your questions and feedback about using declarative metafield and metaobject definitions.