Custom content types

Declare custom content types your app owns in every store that installs it, and read and write their entries.

An app can declare its own custom content (metaobject) types, such as an author or a size chart, in declared_metaobjects of tringify.app.json or in the Developer Portal. Installing the app creates them in the store, owned by the app; merchants see them under Content > Custom content with your app's name. Your app manages their fields; by default the entries are the merchant's data, which merchants and your app both edit, and each type's access settings can keep them to your app.

tringify.app.json json
{
  "declared_metaobjects": [
    {
      "handle": "author",
      "name": "Author",
      "display_field": "name",
      "web_pages": true,
      "address": "authors",
      "schema_kind": "person",
      "app_access": "shared",
      "merchant_access": "read_write",
      "fields": [
        { "key": "name", "name": "Name", "type": "string", "required": true, "searchable": true },
        { "key": "bio", "name": "Bio", "type": "rich_text", "translatable": true },
        { "key": "photo", "name": "Photo", "type": "file_reference" },
        { "key": "favourite", "name": "Favourite book", "type": "metaobject_reference", "metaobject_type": "book" }
      ]
    },
    {
      "handle": "book",
      "name": "Book",
      "display_field": "title",
      "merchant_access": "read",
      "fields": [ { "key": "title", "name": "Title", "type": "string", "required": true } ]
    }
  ],
  "declared_metafields": [
    { "owner_type": "product", "key": "author", "name": "Author", "type": "metaobject_reference", "metaobject_type": "author" }
  ]
}

Each type has the shape of a theme's config/metaobjects.json entry, without sample entries: handle, name, optional description, display_field (a single line text field), web_pages, address, schema_kind (person, place, faq_page or none), the access settings app_access, merchant_access and storefront_visible (see Access settings below) and fields. A field has key, name, type (any metafield type), and optional description, required, choices (select types), translatable, searchable, and metaobject_type for a reference to another of your declared types. A configuration without declared_metaobjects declares none.

Handles#

A declared handle is stored as app--{app handle}--{handle}: the type author of the app with handle reviews is app--reviews--author. The app-- prefix belongs to apps; merchants and themes cannot use it, so your types never collide with theirs or another app's. In the Store API, name your own types $app:{handle} (for example ?type=$app:author) wherever a type id or handle is accepted.

Install, update and uninstall#

  1. Installing the app, and updating an installed app to a new release, creates the types or updates them: fields your release newly declares are added, and existing fields take the declared name, description, translatable and searchable settings. A field is never removed and never changes type. Web pages are turned on when declared (at creation, or by the first release that declares them); if the address is in use, or a redirect already starts there, the type is created without web pages, the type shows requested_address and address_conflict, and Store Admin asks the merchant to choose an address. Once a type has an address, the merchant owns it and the web page setting: later releases never change or remove them, and uninstalling or reinstalling keeps them.

  2. A type the store already has under your handle is taken back only when your app handed it over on an earlier uninstall and its fields still match. Anything else is skipped: the other types and metafields still apply, and metafields pointing at a skipped type are not added. The store's plan allowance never refuses or skips your types: app types and their entries do not count toward it (see Limits).

  3. Uninstalling the app gives its types and entries to the merchant, who can then change or delete them; nothing is deleted. Handed-over types become shared and read_write; storefront_visible stays. From then on they count toward the store's allowance; a store that goes over it keeps everything working and only creating new types or entries waits. The uninstall confirmation lists them, with how far keeping them would take the store over its allowance, and the merchant keeps each type (the default) or deletes it with its entries (the confirmation shows the entries, menu items and references that go with it; a type something still points at is left empty as the merchant's). Reinstalling takes kept types back, and never tightens their access: each setting stays at whichever is more open, the merchant's or your declared one.

  4. Every change fires metaobject_definitions/create or metaobject_definitions/update; the payload's owner is app, owner_ref your app's id and owner_name its name. A hand-over fires metaobject_definitions/update with changed_fields ["owner"], owner merchant and owner_ref still your app's id.

Access settings#

Each declared type takes the access settings of app metafields, with the same option ids. A later release may only open them (private to shared, hidden to read to read_write, not visible to visible); narrowing one is refused with METAOBJECT_APP_TYPE_SETTING_NARROWED.

Setting

Values

What it means

app_access

shared (default), private

Private types and their entries reach only your app: other apps get METAOBJECT_DEFINITION_NOT_FOUND, and their webhooks go only to your app. Shared types other apps with read_metaobjects can read; only your app writes their entries.

merchant_access

read_write (default), read, hidden

read: merchants (Store Admin, the mobile app, connected AI tools, CSV import, bulk actions) see the entries but cannot create, change, publish, unpublish, translate or delete them. hidden: merchants never see the type or its entries, in lists, search, translations, where an entry is used (shown as a count from your app) or their own webhook endpoints. Hidden needs app_access private and storefront_visible false.

storefront_visible

true (default), false

False keeps the entries off the storefront: theme ctx, web pages, storefront search, sitemaps, channel feeds and the shopper API. A type that is not visible cannot have web pages, and a metafield pointing at one of its entries renders nothing there.

A metafield may not show more than the type it points to: a shared metafield cannot point to a private type, a storefront visible one to a type that is not, and one merchants see to a hidden type. Merchants' metafields can point only to shared types they see. Files have no privacy setting: never store secrets in files, which are always visible to the merchant.

Access#

Your app's token reads your types and lists, reads, creates, updates and deletes their entries (including bulk upsert and where an entry is used) without read_metaobjects or write_metaobjects. Translations still need read_translations / write_translations. The merchant's types, other apps' types, types your app handed over, and creating, changing or deleting types through the API all need the metaobject scopes. Without the scope, listing types returns only yours, and any other type answers STORE_API_SCOPE_REQUIRED.

Limits#

Scope

Limit

Custom content types per app

10 (not counted toward the store's plan allowance)

Entries across your app's types, per store

25000 (not counted toward the store's plan allowance)

Fields per type

40

Type handle

Lowercase letters, numbers, hyphens and underscores, starting with a letter, at most 64 characters, unique in your app

Released types and fields

Cannot be removed or change type in a later release; add new ones instead