From 5b667b69c2396eee9519c750e7fe82979df5d54f Mon Sep 17 00:00:00 2001 From: Shohei Tanaka Date: Wed, 18 Aug 2021 05:09:35 +0900 Subject: [PATCH] Remove non-phone number elements When I tested it in the sandbox, the phone number contained invisible data and I couldn't make a payment with WooCommerce validation, so I would like this process. --- includes/class-wc-amazon-payments-advanced-api-abstract.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-amazon-payments-advanced-api-abstract.php b/includes/class-wc-amazon-payments-advanced-api-abstract.php index 58a85267..a7aba926 100644 --- a/includes/class-wc-amazon-payments-advanced-api-abstract.php +++ b/includes/class-wc-amazon-payments-advanced-api-abstract.php @@ -475,7 +475,7 @@ public static function format_address( $address ) { } - $formatted['phone'] = isset( $address->Phone ) ? (string) $address->Phone : null; + $formatted['phone'] = isset( $address->Phone ) ? (string) preg_replace('/[^0-9-_]/', '', $address->Phone) : null; $formatted['city'] = isset( $address->City ) ? (string) $address->City : null; if ( ! empty( $address->CountryCode ) && in_array( $address->CountryCode, array( 'JP' ) ) ) { if ( empty( $formatted['city'] ) ) {