Added Metafield for a product from API but it does not show while editing product

santosh13
Shopify Partner
4 0 1

Hi there, I had added metafield for a product using API but it doesnot show while editing product. There is no data on Product Definition of metafield as well. I could not check whether my metafields are added or not. Doesnot it display in product edition as we can while adding metafields manually from settings page.

Replies 3 (3)

jazz-jay
Shopify Expert
96 14 18

Hi,

 

You need to make it available on the product admin page. Ref this link

banned
santosh13
Shopify Partner
4 0 1

Thanks Jazz-Jay  for your quick response, It was under metafields without definition, I don't see any options there to make it available in product admin page

santosh13_0-1667906158886.png

santosh13_1-1667906213150.png

 

BrianLegault
Shopify Staff (Retired)
2 0 0

Hi @santosh13,

Thanks for reaching out. A couple things I thought I'd touch on.

1. If you want to see the Metafield you created via the REST API:

  • Go to your store's home page.
  • Click on "Products" in the left navigation.
  • Click on the product that you added your Metafield to via the REST API.
  • Scroll all the way to the bottom to see the Metafields section for that product.
  • Click on Show all as seen here: 
  • metafield-show-all.png
  • Click on "Metafields without a definition" similar to how you did in your previous message.

  • In this page you can click on the Metafield value and change it as required.


2. It looks like the 'key' in your Metafield ("Image 1 Path") has invalid characters. It appears to have spaces in it, which is why you're unable to create a Metafield definition that doesn't conform to the documented allowed characters. See here and here which document the allowed characters (alphanumerics, hyphens, underscores, and periods). You won't be able to modify the key as mentioned by the popup window in your screenshot above. You would need to create a new Metafield with namespace & key, with only allowed characters.

You could create your Metafield with the REST API as you did before, just note that the API as you used it, doesn't create a Metafield definition, just a Metafield with an assigned value. You could create your Metafield definition from your store's Admin in the "Definitions" tab on the same page you screen shared above, just as in the link Jazz-Jay shared above.

Hope this helps

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