Unable to Create Meta Field

awayr
New Member
1 0 1

Hi Guys,

I am new at shopify and tried to develop a new plugin.
I am trying to create a metafield for product using private app.
Request:

const UPDATE_PRICE = gql`
 mutation productVariantUpdate($input: ProductVariantInput!) {
   productVariantUpdate(input: $input) {
     product {
       title
     }
     productVariant {
       id
       metafields(first: 100){
        edges {
          node {
            id
            namespace
            key
            value
          }
        }
       }
     }
   }
 }
`;


//input variable
const productVariableInput = {
                                id: variantId,
                                metafields: [
                                  {
                                    namespace: 'global',
                                    key: 'images', value: 'any thing',
                                    
                                  }
                                ],
                                
                              };



it returns the following response

{"data":{"productVariantUpdate":{"product":{"title":"Product Example","__typename":"Product"},"productVariant":{"id":"gid:\/\/shopify\/ProductVariant\/35832469618851","metafields":{"edges":[],"__typename":"MetafieldConnection"},"__typename":"ProductVariant"},"__typename":"ProductVariantUpdatePayload"}},"extensions":{"cost":{"requestedQueryCost":112,"actualQueryCost":12,"throttleStatus":{"maximumAvailable":1000.0,"currentlyAvailable":988,"restoreRate":50.0}}}}

it returns 200 but never saves it.

Thanks in advance

 

 

regilio
New Member
1 0 0

Hi, did you find a solution?

I am currently stuck at the same problem.

0 Likes