Error: Field 'tagsAdd' doesn't exist on type 'Mutation'

Error: Field 'tagsAdd' doesn't exist on type 'Mutation'

Chris_HH
Shopify Partner
1 0 0

I am attempting to programmatically add tags to customers when they access a password protected page. However, I keep getting an error that says "Field 'tagsAdd' doesn't exist on type 'Mutation'," but I can run the same GraphQL statement in the Shopify GraphiQL App successfully. I am using Ajax and querying API version 2024-07.

 

$.ajax({
    url: 'https://{{ store_name }}.myshopify.com/api/2024-07/graphql.json',
    method: 'post',
    headers: {
        'X-Shopify-Storefront-Access-Token': {{ access_token }},
	'Content-Type': 'application/json',
    },
    data: JSON.stringify({
    query: `
    mutation addTags($id: ID!, $tags: [String!]!) {
        tagsAdd(id: $id, tags: $tags) {
	    node {
	        id
	    }
	    userErrors {
	        message
            }
        }
    }
`,
...
Replies 0 (0)