A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
With this new deprecation/change to email marketing consent fields (https://shopify.dev/changelog/new-email-marketing-consent-for-customers-and-deprecated-fields), it looks like all customer records have a null value for the “consent_updated_at” field even when there was a value for “accepts_marketing_updated_at”.
This seems like a bug. I've tried both 2022-04 and unstable on the REST APIs and that value is always null. I've submitted a partner support request mentioning it's a bug, but haven't heard back.
Noticed the same thing today, hopefully there is a fix.
Also noticed that for email_marketing_consent/state that the values coming from the API do not match what is observed through the Shopify console when you look at each Customer manually.
There is no difference between 'Email_unsubscribed' and 'Email_not_subscribed' in the API data. This is not the case for SMS_marketing_consent/state so feels like something is also wrong.
Anyone else seeing this?
@JamesDataships You're seeing the "state" not match as well? From what I was seeing, admittedly somewhat limited so far, it was just the "consent_updated_at" being null even when a value still exists for the "accepts_marketing_updated_at" and the "state" seemed ok.
I'd like to adopt this new API as soon as we can, but we utilize the date form the "accepts_marketing_updated_at" quite a bit, so we're holding off for now.
I'm also seeing cases where the "opt_in_level" is null and doesn't match the original "marketing_opt_in_level". An example partial (no PII) piece of data:
"accepts_marketing_updated_at": "2019-08-10T18:07:49+01:00",
"marketing_opt_in_level": "single_opt_in",
"tax_exemptions": [],
"email_marketing_consent": {
"state": "subscribed",
"opt_in_level": null,
"consent_updated_at": null
}
This makes for an invalid customer record too. Any modifications to that record where we modify something else on the customer and send along the original attributes of the customer will cause a failure like this:
{"errors":{"email_marketing_consent":["The opt-in level is required"]}}
For someone at Shopify, an X-Request-Id associated with this exact issue is: 9af91133-8b34-4590-b8cc-ccf385e9854f
Hello
Any update on the null value for the “consent_updated_at”?
I also submitted this as a bug via the Partner Portal and heard back last week:
"Our team took some time to investigate this, have replicated and been tracking updates to confirm the expected behavior. We are going to continue working with our developers through further investigation, but are unable provide any guarantees of a timeframe for updates."
Hello @MarcBaumbach
Is there any alternative for this because we are updating the API version for our application.
Should we trust on 2022-04 release? and when accepts_marketing, accepts_marketing_updated_at, marketing_opt_in_level properties will deprecated?
I'm not sure of the exact date of removal for the accepts_marketing, etc properties. At the moment, those properties all continue to work. I suspect it's probably 2023-01. What we do is any time we modify those properties, we write to both the old ones and the new ones now to make sure things are correct. Similarly, when we read a customer record we first look to see if the "email_marketing_consent" has values and if so we assume those to be correct. If the values of empty/blanks we backup to the old ones.
There are also some new validations in place on customer records that expect the new properties to have values, so this can be a bit tricky because you may be modifying other parts of the customer record unassociated with the email_marketing_consent but the PUT request will fail because the customer record is in an invalid state. We've resorted to trying to always correct both sets to be aligned with each other on every write back to Shopify. I have a separate bug report open for that, as that's new validation behavior and quite often causes records to fail for unknown reasons for the app. That has also been confirmed, but no timeline/confirmation that a fix is coming there.
@MarcBaumbachI'm seeing similar behavior as well. I've been running a bunch of tests as I'm trying to upgrade to the 2022-04 API. I'm having a hard time getting answers to a lot of these types of questions.
I'm also getting errors when trying to set the `email_marketing_consent.state = not_subscribed`. have you run into any issues with this? This is the error I'm getting: 'email_marketing_consent Cannot update the consent state to not subscribed'. I'm assuming we should be able to subscribe and unsubscribe a customer to email marketing.
I've also noticed that setting these fields on the customer from the order API isn't working either. Typically you can set customer details when creating an order and they are updated. The `email_marketing_consent` fields don't seem to work this way. Curious if you have any insights into this as well.
I haven't tried doing this from the order API, but that's interesting that it doesn't work at all there.
Regarding the error you're seeing when setting it to "not_subscribed", I think you want to set it to "unsubscribed". The not subscribed status is supposed to be for anybody who has never subscribed, so I suspect it's an initial state you can never get back to. Just my two cents on how I read those statuses.
Thanks @MarcBaumbach ! That did the trick. I didn't see a list of states in any of the docs (we're using the REST API) so I was going off what I saw after making changes in the Customer Admin.
Appreciate the help!
Ah, forgot it's not listed there. This is where I originally pulled those states (for anyone who may come across this post in the future): https://shopify.dev/api/admin-graphql/2022-07/enums/CustomerEmailMarketingState