Validate Phone Number Format
Use a checkout validation rule to ensure customers enter phone numbers in the correct format — for example, requiring a specific country code or minimum length.
How to Set Up Phone Number Validation
- Click Create rule → Checkout validation.
- Set up the rule:
- Error message: “Please enter a valid phone number with your country code (e.g., +965).”
- Error position: Phone Address
- Validation trigger: On condition
- Add your condition (see examples below).
- Click Save.
Example: Require a Specific Country Code
To ensure phone numbers start with a specific country code (e.g., Kuwait +965):
- Condition: Phone number → Not starts with → “965”
- Error message: “Please enter a valid Kuwait phone number starting with 965.”
This blocks checkout if the phone number does not start with “965”.
Note: Shopify may store phone numbers with or without the ”+” prefix depending on the theme. If “starts with +965” doesn’t work, try “starts with 965” without the plus sign.
Example: Require Minimum Phone Length
To ensure phone numbers are long enough to be valid:
- Condition: Phone number → Characters length less than → 8
- Error message: “Phone number must be at least 8 digits.”
Example: Block Empty Phone Numbers
To require a phone number at checkout:
- Condition: Phone number → Is empty
- Error message: “A phone number is required to complete your order.”
Combining Conditions
You can combine phone validation with other conditions:
Require country code only for domestic orders:
- Group 1: Phone number → Not starts with → “965” AND Country → Equals to → Kuwait
- Error message: “Kuwait orders require a phone number starting with 965.”
This only validates the phone format for Kuwaiti addresses — international customers are not affected.
Good to Know
- Phone number format varies by theme. Some themes include the country dial code, others don’t. Test with your actual checkout to see the format your theme uses.
- Place the error under the right field. Set error position to “Phone Address” so the error appears next to the phone input, not at the top of the page.
- Test first. Use Test mode with
test@testing.comto verify the validation works as expected before activating.