Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Email consent GraphQL

Solved

Email consent GraphQL

jbinkydev
Shopify Partner
2 1 0

Hey guys!

 

Looking to replace a script that previously used the depreciated acceptsMarketing when creating a customer. Essentially I'd like to create a customer who has given consent to be opted in.

 

mutation {

  customerCreate(

    input: {

      email: "tes0910@example.com"

      emailMarketingConsent: {

        marketingState: SUBSCRIBED

        marketingOptInLevel: SINGLE_OPT_IN

        consentUpdatedAt: "2024-10-09T23:49:48Z"

      }

    }

  ) {

    customer {

      id

    }

  }

}

 

Customer record is being created, but still not opted in. I've tried "PENDING" as well, no luck.

 

Any ideas or advice would be most appreciated!

Accepted Solution (1)
jbinkydev
Shopify Partner
2 1 0

This is an accepted solution.

Hi Jay, good point! Was using the latest 2024/10

 

I removed consentUpdatedAt and it works for me! Had been trying so many things but looks like the date was throwing it off for some reason

 

Thanks!

View solution in original post

Replies 2 (2)

JayAdra
Shopify Partner
195 15 53

What API version are you using? I use essentially the same mutation and it works fine for me.

 

Are you on 2024-07 or later?

jbinkydev
Shopify Partner
2 1 0

This is an accepted solution.

Hi Jay, good point! Was using the latest 2024/10

 

I removed consentUpdatedAt and it works for me! Had been trying so many things but looks like the date was throwing it off for some reason

 

Thanks!