Creating/updating privateMetafield in Product/Collection

gianlucasaroni
New Member
3 0 0

Hi all,

I'm trying to add/update privateMetafield in Product/Collection following docs (https://shopify.dev/apps/metafields/private) but unfortunately I'm getting "Internal Error":

[GraphQL error]: Message: Internal error. Looks like something went wrong on our end.
Request ID: 2b568498-35e9-4d2e-b735-b90ca8f40701 (include this in support requests)., Location: undefined, Path: undefined

gql

mutation ($input: CollectionInput!){
    collectionUpdate(input: $input) {
        collection {
            privateMetafields(first:10) {
                edges {
                    node {
                        namespace
                        key
                        value
                    }
                }
            }
        }
    }
}

Input data 

{
    input: {
        id: collectionId,
        privateMetafields: [{
            namespace: "myNameSpace",
            key: "myKey",
            valueInput: {
                value: "myData",
                valueType: "STRING"
            }
        }]
    }
}
0 Likes
csam
Shopify Staff
Shopify Staff
102 14 17

Hi @gianlucasaroni 

Thank you for providing the x-request-id for your API request. I had a look and saw that you're using the type "string" which has been deprecated. You will want to use either single_line_text_field or multiple_line_text_field.

You can see the currently valid types here: https://shopify.dev/apps/metafields/definitions/types

I'll follow up with you as well via your support ticket, as I'm not 100% certain that is the cause of the errors you've been receiving.

CS | API Support @ 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 Shopify.dev or the Shopify Web Design and Development Blog

0 Likes
gianlucasaroni
New Member
3 0 0

uhm so PrivateMetafields has the same available type of Metafields?

btw I fixed the problem on products so I'm able to set privateMetafields on it, but I have 2 more questions:

  • is it possible to add privateMetafields on Collections?
  • is it possible to query all products (or collections) that has specific privateMetafield valorized? 

 

Thanks.

0 Likes