Any one done the App Own meta graphql API 'mutation CreateAppOwnedMetafield'

Topic summary

Issue: Developers are seeking guidance on creating app-owned metafields using Shopify’s Admin GraphQL API, specifically after upgrading to version 2023-04.

Solution Provided:

  • Use the metafieldsSet mutation instead of the deprecated CreateAppOwnedMetafield
  • Set the ownerId to the app’s AppInstallation object ID
  • Example mutation structure provided with MetafieldsSetInput variables

Key Updates (API 2023-01+):

  • The type parameter is no longer required when a metafield definition already exists
  • This change affects how metafields are updated in app features

Remaining Challenges:

  • Difficulty finding updated documentation for version 2023-04
  • Uncertainty about whether to pass type when updating existing app metafield values
  • Theme app extension code fails to run when metafield values aren’t stored/initialized, causing Liquid template conditional checks to fail

Status: Partially resolved with implementation guidance, but questions remain about best practices for updates and theme extension integration.

Summarized with AI on November 19. AI used: claude-sonnet-4-5-20250929.

HI all,
Does any one using the AppOwnedMetafield
this was Shopify admin API grapql. 2022-04 ,

As per the old document { "created_at": "2012-03-13T16:09:54-04:00", "description": "The number of units at the warehouse.", "id": 915396206, "key": "warehouse", "namespace": "inventory", "owner_id": 548380009, "owner_resource": "product", "updated_at": "2012-08-24T14:02:15-04:00", "value": "25", "type": "single_line_text_field" }

but it for latest API version 2023-04. what was the way to create app own meta or app secure meta value.. !!
@Shopify_77

To create an app-owned metafield in Shopify Admin API GraphQL, you need to use the metafieldSet mutation and set the ownerID to the ID of the AppInstallation object associated with the app. Here’s an example of how to create an app-owned metafield:

mutation CreateAppOwnedMetafield($metafieldsSetInput: [MetafieldsSetInput!]!) {
  metafieldsSet(metafields: $metafieldsSetInput) {
    metafields {
      id
      namespace
      key
    }
    userErrors {
      field
      message
    }
  }
}

And the variables for the mutation:

{
  "metafieldsSetInput": [
    {
      "namespace": "your_namespace",
      "key": "any_key",
      "type": "single_line_text_field",
      "value": "blah blah blah",
      "ownerId": "gid://shopify/AppInstallation/541153067321"
    }
  ]
}

Remember to replace the ownerId value with the correct AppInstallation ID for your app. For more information, you can refer to the Shopify documentation on app-owned metafields.

1 Like

@Shayne Thanks I was using the same code as now my app side.
Issue i am facing.

  1. We are updating Shopify admin API latest version 2023-04. I was looking into the document i was not found any reference for the same.

  2. We can see the API notice. We are updating same app meta value it was in an app feature.
    this case what was the solution do not passing the type time of meta creation ?

As of 2023-01, metafieldsSet no longer requires type when a corresponding metafield definition exists. View change

  1. facing issue into accessing those meta value in the theme app extension checking those meta field value into when those value is not started liquid code stop ruining

` this working when value is stored.

{% if app.metafields.myapps.appmeta1.value %}
app liquid code

{% endif %}

`

` This code block run all

{% if app.metafields.myapps.appmeta1 %}
app liquid code

{% endif %}

`