Cannot set the customer’s sms consent

Hey @dev00 ,

Thanks for your post.

I did some digging and found this GraphQL mutation and example for unsubscribing to sms marketing worked really well! I tested it as well with the mutation below.

mutation customerSmsMarketingConsentUpdate($input: CustomerSmsMarketingConsentUpdateInput!) {
  customerSmsMarketingConsentUpdate(input: $input) {
    userErrors {
      field
      message
    }
    customer {
      id
      phone
      smsMarketingConsent {
        marketingState
        marketingOptInLevel
        consentUpdatedAt
        consentCollectedFrom
      }
    }
  }
}

Variables

{
"input": {
"customerId": "gid://shopify/Customer/customerid",
"smsMarketingConsent": {
"marketingOptInLevel": "SINGLE_OPT_IN",
"marketingState": "UNSUBSCRIBED"
}
}
}

Note: customerid would need to be changed to the customerid you would like to alter.

Hope this helps!