Help on how to delete metafields without a definition

I’m working towards a switch to version 2.0 and part of this involves making use of metafields for products specifications etc.

I created the metafields in my shopify admin and installed the metafields 2 app to import these. After some trial and error, I’ve been able to import what I need, but I’ve been left with quite a lot of junk data in “metafields without a definition”.

I’ve read that junk can affect site performance, so I’d like to get rid of these. The metafields 2 app doesnt allow me to do this. Shopify support suggested that this could be done using shopify API, but I’m not a developer and would have concerns that I might create more problems if I try this.

I wanted to reach out to see if anyone had an easy solution for this which would allow me to clear this unwanted data.

It would be possible to create a flow in Shopify Flow App to run, say, each time the product status is changed, loop over all metafields and delete ones which do not have a definition.

This, however, is not really safe – there is a lot if information stored in metafields by Apps, like product review data or Google Shopping product categories, etc.

While these has no definition, deleting them would not be wise.

Also, i doubt having a bunch of extra metafields would really slow down your store (though I have no testing data).
Unless you have hundreds of metafields or some notoriously bad code to loop over all of them each time product card is rendered in collection grid I would not pay much attention to it.

1 Like