Delete old metafields from uninstalled (and possibly deleted) apps

Delete old metafields from uninstalled (and possibly deleted) apps

Shopify Partner
14 0 9

During development of a new app I've created some metafield definitions for my products. I've now uninstalled the app, but these metafield definitions are still visible for the merchant which is useless for them and clutters the interface. How can a merchant delete old metafields that are not in use anymore?


I've been trying to manually remove the fields via my app (* which doesn't work, see note below), but some of my metafields have been created with a test app which since then has been completely deleted and so even if deleting would be possible, there is no way for me to access its namespace anymore, which means I can't get the needed permission to modify anything. Is there no way for a merchant to overrule this and delete them anyway? I can't imagine every app cleans up after itself and there must be some way for users to do this themselves, right?


* I've been in contact with support about this issue, but it hasn't been resolved yet. Basically it seems I'm unable to delete a metafield definition I created myself. Using GraphQL (or even the GraphIQL app) I can create a new metafield definition and receive its ID. Then when I try to delete the metafield definition with that ID I get a 500 error from the Shopify server "something seems to have gone wrong on our side". This makes it a lot harder for me to test my app during development, and won't allow me to clean up after my app when a merchant uninstalls it.

Replies 3 (3)

Shopify Partner
14 0 9

Added some steps on reproduction my deleting-metafield-definitions problem, but it's not really related to my question on how merchants can delete these definitions/fields.

Shopify Partner
14 0 9

There seem to be so many issues with these metafields and objects...

Another example of something that I think doesn't work as it should (OR if I'm doing something wrong it's not communicating the error properly to me):


I'm creating a metafield definition with the following definition:


definition = {
   namespace: '$app:custom',
   ownerType: 'PRODUCT',
   pin: true,
   validations: [],
   visibleToStorefrontApi: false,
   access: { admin: 'MERCHANT_READ_WRITE' },
   name: 'my name',
   key: 'my_key',
   type: 'number_integer'

The result is an error:

 error:  [
     field: [ 'definition' ],
     message: 'Namespace and key is already in use for a set of your metafields.',

 First of all, I'm not sure how 'UNSTRUCTED_ALREADY_EXISTS' differs from the error code 'TAKEN' which also exists, but it tells me I already use this key in this namespace, so I should be able to get an ID for that existing object. So I request it;

{ namespace: '$app:custom', key: 'my_key', ownerType: 'PRODUCT' }

And the result is... nothing. There is no metafield definition with that combination. I do have a metafield definition with that key on another app (I'm working with a production and development version of my app, as per the docs) but that one is using another namespace (thanks to $app:custom (which I can confirm by looking at the list of metafields in the admin frontend of my apps).

Shopify Partner
53 7 10

Ran into the same thing today, did anyone at Shopify ever reach out with a solution?

Head of space operations on the Shopify moon-base.