There is a misunderstanding in the customer email marketing consent update API documentation

If you look at the `customerEmailMarketingConsentUpdate` API documentation, the example code changes the status to “NOT_SUBSCRIBED.”

However, the actual API behavior prevents this change. Did you notice?

And the “REDACTED” status explicitly states that it’s read-only. Therefore, “NOT_SUBSCRIBED” appears to be a changeable status, making it even more confusing.

Isn’t this clearly a potential source of misunderstanding?

Hi @KubrickCode,

Thanks for sharing this with us, I am able to replicate this on my own test store as well, with the NOT_SUBSCRIBED and INVALID states both returning an error indicating they can’t be used.

I am currently discussing this with our developers to confirm if this is expected behaviour or not, and if so to update our Shopify.dev documentation to reflect this.

In the meantime, I would recommend using the UNSUBSCRIBED marketing state to mark customers that are not subscribed for email marketing via the API.

I will follow up here as soon as we have any further information on the confirmation of this behaviour!

Hi @KubrickCode,

I just wanted to follow up here and let you know that we have looked into this behaviour further and have confirmed that both the NOT_SUBSCRIBED and INVALID states are in fact read-only values for the customerEmailMarketingConsentUpdate mutation.

If you need to update the marketing consent status to not subscribed, you should use the UNSUBSCRIBED value instead, then after the mutation is ran the actual marketingState value on the Customer object will be set to NOT_SUBSCRIBED automatically.

Our developers are aware of the inconsistency in the Shopify.dev documentation for the marketingState value enum, and we will be updating the docs to clarify this further.

1 Like