Are you using a client like Postman to make this mutation? If you try making the same mutation with the GraphiQL app, are you seeing the expected change occuring?
I am using Postman as well as C# and both have the same result.
When I use GraphiQL app, I receive the error “Access denied for customerEmailMarketingConsentUpdate field. Required access: write_customers access scope.”. My understanding is I don’t have the ability to update the access of the app when running through the shopify admin area.
You should be able to change the access scopes for the Shopify GraphiQL app by uninstalling it from your store, then re-installing with the newly selected scopes via the link Liam shared above.
Custom apps setup in a shop’s admin can update their scopes directly in the App’s section of the UI, and we have a guide on how to update OAuth scopes as well if that’s how your C# app is setup.
Thanks. After uninstalling and reinstalling the app, I was able to select the correct permissions and run the query in the GraphiQL without the access error.
If you don’t add a “consentUpdatedAt” that is greater than or equal to the existing “consentUpdatedAt” value, the marketingState will not be updated AND you don’t receive an error or message explaing why it wasn’t updated.
For example, if the “consentUpdatedAt” is ‘2024-01-16’, then in order to update the marketingState, you must pass the “consentUpdatedAt” to be at least ‘2024-01-16’. You can’t set it to ‘2024-01-15’. While this makes sense, if the “consentUpdatedAt” had a timestamp attached, such as ‘2024-01-16T01:01:01Z’, you couldn’t use just ‘2024-01-16’ as the value. You must include a timestamp to make it at least ‘2024-01-16T01:01:01Z’.
I tested this many times and this seems to be exactly what is happening. If I am wrong, please let me know.