MainWP Community

Remove leading first zero on the billing phone number after registration in WooCommerce

Remove leading first zero on the billing phone number after registration in WooCommerce on your child site.

Snippet Type

Execute on Child Sites

Snippet

function removezero( $user_id ) {
    if (isset($_POST['billing_phone'])) {
       update_user_meta( $user_id, 'billing_phone', $_POST['billing_phone'] = preg_replace('/^0/', '', $_POST['billing_phone']));
    }
}