Validate Phone Numbers by Country Code

Ensure customers enter phone numbers with the correct country code for their region. This is useful for stores that need valid local phone numbers for delivery coordination or compliance.

Basic Setup: Require a Specific Country Code

Example: Require Kuwait country code (+965)

  1. Click Create ruleCheckout validation.
  2. Rule name: “Require Kuwait phone code”
  3. Rule status: Test
  4. Error message: “Please enter a valid Kuwait phone number starting with 965.”
  5. Error position: Phone Address
  6. Validation trigger: On condition
  7. Add two conditions in the same group (AND):
    • Condition 1: Phone number → Not starts with → “965”
    • Condition 2: Country → Equals to → Kuwait
  8. Click Save.

This blocks checkout only when:

  • The customer’s country is Kuwait, AND
  • Their phone number does not start with “965”

International customers are not affected.

Note on the ”+” prefix: Shopify may store phone numbers with or without the ”+” symbol depending on your theme. If “Not starts with +965” doesn’t catch the right numbers, try “Not starts with 965” without the plus sign. Test both formats to see which one your theme uses.

Require Phone Number Format for Multiple Countries

Create separate rules for each country:

Rule 1 — US phone numbers:

  • Phone number → Not starts with → “1”
  • Country → Equals to → United States
  • Error: “US orders require a phone number starting with 1.”

Rule 2 — UK phone numbers:

  • Phone number → Not starts with → “44”
  • Country → Equals to → United Kingdom
  • Error: “UK orders require a phone number starting with 44.”

Require a Minimum Phone Number Length

To catch obviously invalid short numbers:

  1. Click Create ruleCheckout validation.
  2. Error message: “Please enter a complete phone number (at least 8 digits).”
  3. Error position: Phone Address
  4. Condition: Phone number → Characters length less than → 8
  5. Click Save.

Block Empty Phone Numbers

To require a phone number at checkout:

  1. Click Create ruleCheckout validation.
  2. Error message: “A phone number is required to complete your order.”
  3. Error position: Phone Address
  4. Condition: Phone number → Is empty
  5. Click Save.

Testing

  1. Set rule status to Test.
  2. Go to checkout with test@testing.com.
  3. Select the target country and enter a phone number WITHOUT the required code — the error should appear under the phone field.
  4. Enter a valid phone number WITH the correct code — checkout should proceed.
  5. Select a different country — the rule should NOT trigger (if you added a country condition).
  6. Once confirmed, set to Active.

Tips

  • Always pair phone validation with a country condition unless you want the rule to apply globally. Otherwise, customers from other countries will be blocked too.
  • Place the error under “Phone Address” so the message appears next to the phone field, making it clear what needs to be fixed.
  • Phone format varies by theme. Your theme controls whether the phone field includes a country code picker or just a text input. Test with your actual theme.