woocommerce-phone-validator
woocommerce-phone-validator copied to clipboard
Phone validation error: Internal error π₯Ά
No error in the debug log in debug mode, no other...anything...
`
WordPress Environment
WC Version: 4.8.0 REST API Version: β 4.8.0 WC Blocks Version: β 3.8.1 Action Scheduler Version: β 3.1.6 WC Admin Version: β 1.7.3 Log Directory Writable: β WP Version: β 5.5.3 - There is a newer version of WordPress available (5.6) WP Multisite: β WP Memory Limit: 256 MB WP Debug Mode: β WP Cron: β Language: hu_HU External object cache: β
Server Environment
Server Info: LiteSpeed PHP Version: 7.4.13 PHP Post Max Size: 256 MB PHP Time Limit: 240 PHP Max Input Vars: 1000 cURL Version: 7.71.0 OpenSSL/1.1.1d
SUHOSIN Installed: β MySQL Version: 10.3.27-MariaDB Max Upload Size: 128 MB Default Timezone is UTC: β fsockopen/cURL: β SoapClient: β DOMDocument: β GZip: β Multibyte String: β Remote Post: β Remote Get: β
Database
WC Database Version: 4.8.0 WC Database Prefix: wp_ Total Database Size: 279.19MB Database Data Size: 229.85MB Database Index Size: 49.34MB
Post Type Counts
astra_adv_header: 1 attachment: 482 cartflows_flow: 1 cartflows_step: 2 customize_changeset: 6 custom_css: 2 elementor_library: 17 is_search_form: 1 nav_menu_item: 52 oembed_cache: 268 page: 46 popup_theme: 6 post: 281 product: 6 pt_view: 1 revision: 4070 rp4wp_link: 880 seopress_404: 334 shop_coupon: 7 shop_order: 2897 shop_order_refund: 1 testimonials: 3 wc_afrsm: 2 wc_dynamic_pricing: 5 woo_coupon_reminder: 2 woo_mb_template: 23 wpforms: 1 wp_show_posts: 1 ywrac_cart: 1
Security
Secure connection (HTTPS): β Hide errors from visitors: β
Active Plugins (57)
Dropin Plugins (1)
advanced-cache.php: advanced-cache.php
Must Use Plugins (1)
Health Check Troubleshooting Mode: by β 1.7.2
Settings
API Enabled: β Force SSL: β Currency: HUF (Ft) Currency Position: right_space Thousand Separator: Decimal Separator: , Number of Decimals: 0 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) variable (variable)
Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5)
Connected to WooCommerce.com: β
WC Pages
Shop base: #9538 - /shop/ Cart: #33 - /cart/ Checkout: #9493 - /checkout/ My account: #35 - /my-account/ Terms and conditions: #1985 - /aszf/
Theme
Name: Astra Version: 2.6.2 Author URL: https://wpastra.com/about/ Child Theme: β β If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme WooCommerce Support: β
Templates
`
Please fix this asap. am also facing same issue
I use a custom php code now, but the plug-in would be fine:
add_action('woocommerce_checkout_process', 'phonenumber_custom_checkout_field_process'); function phonenumber_custom_checkout_field_process() { if( is_checkout() ) { global $woocommerce; if ( ! (preg_match('/^+[1-9][0-9]{9,}$/', $_POST['billing_phone'] ))) { wc_add_notice( "A megadott mobiltelefonszΓ‘m helytelen!" ,'error' ); } } }
is it solve the problem?
Alternative solution until the problem has resolved.
devgene [email protected] ezt Γrta (idΕpont: 2021. jan. 23., Szo 10:15):
is it solve the problem?
β You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Preciousomonze/woocommerce-phone-validator/issues/38#issuecomment-765893621, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHNHTWV6G5QOS434X5J4H3TS3KHSRANCNFSM4V2PHYWQ .
Hi folks, I'm so sorry about the delay. Been having a tough time here. And thanks for the temporary fix @Estalhun π₯Ίπ I'll try to check it through and merge into my v2 branch, please do not be angry. π«ππ
Hello, any update here?
Improved solution:
add_action('woocommerce_checkout_process', 'my_custom_checkout_field_process');
function my_custom_checkout_field_process() {
$myerr = false;
if( is_checkout() ) {
global $woocommerce;
$POST['billing_phone'] = '+' . trim( preg_replace( '/[\s#+-/().]/', '', $_POST['billing_phone'] ) );
if ( ! (preg_match('/^+[1-9][0-9]{9,}$/', $_POST['billing_phone'] ))) {
$myerr = true;
wc_add_notice( 'Wrong mobile number: ' . $_POST['billing_phone'] ,'error' );
}
if ( ! (preg_match('/\d+/', trim($_POST['billing_address_1']) ))) {
$myerr = true;
wc_add_notice( 'Wrong address!' ,'error' );
}
if ( isset($_POST['shipping_postcode']) && trim($_POST['shipping_postcode']) != '' ) {
if ( ! (preg_match('/\d+/', trim($_POST['shipping_address_1']) ))) {
$myerr = true;
wc_add_notice( 'Wrong shipping address!' ,'error' );
}
}
if ( $myerr ) {
wc_add_notice( 'Additonal error message:<br /> <p>Additonal error message about the addresses.</p> <p>Additonal error message about the mobile number:+36701234567</p> Additonal error message<br />
Thank you' ,'error' );
}
}
}
I think, there is needed more complex solution. If customer enter country code, spaces in phone number, etc ..
For example, in the Czech Republic, it should be possible to specify all these formats: +420605000111 +420 605 000 111 605 000 111 605000111
This line does it: $POST['billing_phone'] = '+' . trim( preg_replace( '/[\s#+-/().]/', '', $_POST['billing_phone'] ) );
Hello, any fix? and do I add the improved solution as a snippet and remove the plugin?
Hello, any fix? and do I add the improved solution as a snippet and remove the plugin?
Yeah, try the code without the plug-in. You can insert the php code with this plug-in (without editing function.php or child theme): https://docs.spacexchimp.com/plugin-installation.html?#plugin/my-custom-functions