Showing all 68 results
// Wallmora – always save order phone numbers as 10 digits function wallmora_clean_phone( $phone ) { $p = preg_replace( '/\D/', '', (string) $phone ); if ( strlen( $p ) === 12 && substr( $p, 0, 2 ) === '91' ) { $p = substr( $p, 2 ); } elseif ( strlen( $p ) === 11 && $p[0] === '0' ) { $p = substr( $p, 1 ); } return $p; } add_action( 'woocommerce_before_order_object_save', function ( $order ) { $b = $order->get_billing_phone(); if ( $b && wallmora_clean_phone( $b ) !== $b ) { $order->set_billing_phone( wallmora_clean_phone( $b ) ); } $s = $order->get_shipping_phone(); if ( $s && wallmora_clean_phone( $s ) !== $s ) { $order->set_shipping_phone( wallmora_clean_phone( $s ) ); } } );
Showing all 68 results
No account yet?
Create an Account