=== Phone Number Validation ===
Contributors: w7s
Tags: phone validation, WooCommerce, international phone, checkout, billing, shipping, intl-tel-input, Twilio
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
WC requires at least: 7.0
WC tested up to: 9.9
Stable tag: 1.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Validates international telephone numbers on WooCommerce billing and shipping addresses, ensuring accurate customer contact information and enhancing the checkout experience.

== Description ==

The **Phone Number Validation** plugin enhances your WooCommerce store by ensuring that customers provide valid and correctly formatted phone numbers during the checkout and account management processes. Leveraging the powerful [intl-tel-input](https://github.com/jackocnr/intl-tel-input) library supported by [Twilio](https://twilio.com/), this plugin offers robust validation, customizable settings, and seamless integration with both classic and block-based WooCommerce checkouts.

**Key Benefits:**
- **Enhanced Data Accuracy:** Ensures all customer phone numbers are valid and correctly formatted, reducing errors in contact information.
- **Improved User Experience:** Provides real-time validation feedback, helping customers correct their phone numbers promptly.
- **Customization:** Extensive settings to tailor validation according to your store’s requirements, including country restrictions and preferred formats.
- **Seamless Integration:** Works effortlessly with both classic and block-based WooCommerce checkouts, ensuring consistency across your store.
- **Developer-Friendly:** Built with clean, maintainable code adhering to WordPress and WooCommerce standards, making it easy to extend or modify.

**Features:**
- Real-Time Phone Number Validation
- International Support with customizable country selections
- Separate Dial Code Display with country flags
- Optional Shipping Phone Field
- Comprehensive Settings Panel
- Compatibility with WooCommerce Blocks
- Debug Logging for troubleshooting

== Installation ==

1. **Download the Plugin:**
   - Purchase and download the plugin zip file from the [official WooCommerce marketplace](https://woocommerce.com/product/phone-number-validation).

2. **Upload to WordPress:**
   - Log in to your WordPress admin dashboard.
   - Navigate to `Plugins` > `Add New`.
   - Click on the `Upload Plugin` button.
   - Choose the plugin `.zip` file you downloaded and click `Install Now`.

3. **Activate the Plugin:**
   - After installation, click the `Activate Plugin` button.
   - The plugin is now active and ready for configuration.

4. **Configure Plugin Settings:**
   - Navigate to `WooCommerce` > `Settings` > `Shipping` > `Phone Validation` to access the plugin’s settings panel.
   - Alternatively, click on `Settings` under the plugin to configure its options.

**Requirements:**
- **WordPress:** Version 6.0 or higher
- **WooCommerce:** Version 7.0 or higher
- **PHP:** Version 7.4 or higher
- **HTTPS:** Recommended for secure data transmission
- **`intl-tel-input` Library:** Already included with this plugin

== Frequently Asked Questions ==

= 1. How do I enable the shipping phone field? =

Navigate to `WooCommerce` > `Settings` > `Shipping` > `Phone Validation`. Check the option **Add shipping phone field** and save your changes. You can also choose to make this field required by enabling the **Make shipping phone required** option.

= 2. Can I restrict phone number validation to specific countries? =

Yes. In the plugin settings, you can specify **Supported Countries** to limit validation to certain countries. Additionally, you can set **Preferred Countries** to prioritize specific countries in the dropdown list and **Exclude Countries** to remove certain countries from the selection.

= 3. How does the plugin handle international phone numbers? =

The plugin uses the `intl-tel-input` library to support international phone numbers. It displays country flags and allows users to select their country code from a dropdown. Phone numbers are validated based on the selected country, ensuring accurate formatting.

= 4. What happens if a customer enters an invalid phone number? =

If an invalid phone number is detected during checkout, the plugin displays an error message prompting the customer to correct the number. In block-based checkouts, the "Place Order" button is disabled until the phone number is valid.

= 5. Is debug logging available for troubleshooting? =

Yes. You can enable debug logging by checking the **Enable debug** option in the plugin settings. This will log phone validation processes, aiding in troubleshooting any issues that arise.

= 6. Does the plugin support both classic and block-based WooCommerce checkouts? =

Yes. The plugin is designed to work seamlessly with both classic and block-based checkout systems, ensuring consistent validation and user experience across different WooCommerce setups.

= 7. How can I customize the initial country displayed in the phone input field? =

In the plugin settings under **Initial Country**, select the desired country that should be displayed by default when customers access the checkout or account pages.

= 8. Can I exclude specific countries from the phone number validation? =

Yes. Use the **Exclude Countries** setting to remove specific countries from the phone number validation dropdown, preventing customers from selecting them during checkout.

= 9. Where are the validated phone numbers stored? =

Validated phone numbers are saved to the order metadata in WooCommerce. You can view them in the order details within the WooCommerce admin dashboard.

= 10. Is the plugin compatible with High Performance Order Storage (HPOS)? =

Yes. The plugin is designed to work seamlessly with both HPOS and traditional order storage.

= 11. Is the plugin compatible with other WooCommerce extensions? =

The plugin is built to adhere to WooCommerce standards, ensuring compatibility with most WooCommerce extensions. However, if you encounter any conflicts, please reach out to our support team for assistance.

== Changelog ==

= 1.5 =
* Add - Make country code dropdown list filterable on checkout.
* Add - WooCommerce version compatibility bump.

= 1.4 =
* Add - WooCommerce version compatibility bump.
* Fix - Show correct country codes/flags for logged-in users with saved phone numbers.

= 1.3 =
* New - String translation files for es_ES, de_DE, fr_FR, ru_RU, nl_NL, ja, zh_CN, sv_SE, fi, da_DK, el, tr_TR, he_IL, ko_KR, ar, id_ID, pt_BR
* Fix - Only enqueue scripts on My Account page if we're on the edit address page.
* Fix - Fix incorrect country flags on block checkout when using "Allowed countries" filter.
* Update - Deprecate allowed countries setting.

= 1.2 =
* Fix - QIT & Coding standards fixes.

= 1.1 =
* New - Add option to force checkout even when phone validation errors are present.
* New - Add phone field availability check on block checkout. If it's not, show an error message in admin.
* New - Only show "Add shipping phone" option if classic shortcode method is used.

= 1.0 =
* Initial release.


== Short Description ==

Enhance your WooCommerce store with robust phone number validation, ensuring accurate customer contact information and a seamless checkout experience.

