Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

How To Delete A Metafield

How To Delete A Metafield

Terry_Middleton
Shopify Partner
50 0 5

How do you delete a metafield in Ruby on Rails?

I got how to Add a metafield and update, but seem to not be able to delete.  Has anyone does this before?

Terry

Replies 4 (4)

Kevin_Hughes
Shopify Staff (Retired)
130 0 19

Hi Terry,

you can delete a Metafield by making a DELETE request to /admin/metafields/*********.json. Here are the docs http://docs.shopify.com/api/metafield#destroy. If you are using our ruby API gem then you can call destroy() on the object and it should delete it.

 

To learn more visit the Shopify Help Center or the Community Blog.

pete96
New Member
16 0 0

How would this be done using the Python package?

Chris_Saunders
Shopify Staff
591 0 53

When you create a metafield you will be returned an resource with an ID. You can then just simply delete the resource.

metafield = ShopifyAPI::Metafield.find(SOME_META_ID)
metafield.destroy

 

Chris | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Terry_Middleton
Shopify Partner
50 0 5

Chris Thank You!