Unable to submit draft order - error “email contains an invalid domain”
This occurs when referencing a customer that already exists in Shopify, why is draft order validating the domain if its already a customer in Shopify?
Steps to repro:
In a test store, create a customer with email on the gmail.ru domain eg <email address>@gmail.ru
Submit a draft order referencing the customer above
…for example with the graphql api (but this is also reproducible in the Admin UI)
Mutation:
mutation DraftOrderMutation($input: DraftOrderInput!) {
draftOrderCreate(input: $input){
draftOrder {
id
}
userErrors {
field
message
}
}
}
Input Variables:
{
"input": {
"customerId": "<<graph customer id that has the @gmail.ru email>>",
"lineItems": [
{
"quantity": 1,
"variantId": "<<some valid variant id from your store>>"
}
]
}
}
I can confirm this is expected behaviour as the gmail.ru domain is not a valid domain that accepts emails, and the email validation is ran specifically when creating orders to ensure that fraudulent orders are prevented on the platform.
Doing a quick google search of the gmail.ru domain, returns some results from google support that specify that country specific domains such as these are typically a domain trap for spammers or scammers, and that Gmail only uses the @gmail.com and @googlemail.com domains for Gmail users.
While we can confirm that this error is expected behaviour when creating Draft Orders with this email address, I am currently discussing with our developers internally if it is expected behaviour for the email validation to be ran when creating new customers or not.
I will follow up in this thread here as soon as we have more information to share!
I have discussed this with our developers internally further, and they have confirmed that this is expected behaviour and was done this way by design.
The customer creation does have email validation, however it’s a less strict validation than order creation email validation.
Customer creation validation only checks that the emails input have valid formatting for an email address, while Checkout and Order creation has stricter validations rules checking things like MX DNS records to confirm the domain can actually receive emails, to prevent fraudulent orders from being placed.
I do understand that you may want more strict email validation for customer creation as well, and I can definitely submit some feedback internally on your behalf for this if you like. We do take all our partner and merchant feedback with great value when determining future features and platform updates.