API to create a product issue with meta fields

API to create a product issue with meta fields

iamarsibragimov
Shopify Partner
3 0 1

Hi!

 

I use API to create a product but there is an issue with meta fields. For some reason, they are not set up.

 

What am I doing wrong?

 

2023-01-26_15-52-52.png   2023-01-26_15-54-15.png

  

Replies 3 (3)

ShopifyDevSup
Shopify Staff
1453 238 511

Hi @iamarsibragimov 👋

 

It's likely that `global` is not the correct namespace for the `ispattern` metafield from your screenshot. If you click text field for `ispattnern` in the Admin UI, there should be a link to its "Definition" that includes it's namespace. 

 

 

Alternatively, you can use the following GraphQL query for `MetafieldDefinitions`:

{ 
    metafieldDefinitions (ownerType: PRODUCT, first:100) {
        nodes {
            name
            namespace
            key
        }
    }
}

 

Hope that helps!

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

iamarsibragimov
Shopify Partner
3 0 1

Thx for the answer. Where can I find def in Admin UI? I only see this

 

Screenshot 2023-01-26 at 21.56.23.png

ShopifyDevSup
Shopify Staff
1453 238 511

Hey @iamarsibragimov, 

Great question. If you favor working with metafields in the admin over the API or are cross-referencing how this will look in the admin - we offer a detailed guide in our help docs working with Metafields here. The screenshot shared in your last post is the metafields definition available through the admin. 

There is also a dedicated section in our docs on editing a definition through the admin that includes a few insights, such as follows:
 

You can only edit custom metafield definitions. Standard metafield definitions are automatically configured for you and they can't be edited.


For any other questions or concerns around using the admin features available, don't hesitate to connect with Shopify Support here or consider posting in the Technical Q&A community board here.

If you are looking for additional insights into working with metafields using the API, after reviewing our extensive developer resources we'd suggest bringing additional questions back to this community board.

- Cheers!

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog