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

  1. Click Create ruleCheckout validation.
  2. 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
  3. Add your condition (see examples below).
  4. Click Save.

Example: Require a Specific Country Code

To ensure phone numbers start with a specific country code (e.g., Kuwait +965):

  • Condition: Phone numberNot 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 numberCharacters 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 numberIs 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.com to verify the validation works as expected before activating.