diff --git a/src/Helper/Utils.php b/src/Helper/Utils.php index c37c5c51..d0c956ea 100644 --- a/src/Helper/Utils.php +++ b/src/Helper/Utils.php @@ -472,7 +472,7 @@ public static function build_customer_address_from_order(Order $order) { return array( 'street' => substr($order->getWcOrder()->get_billing_address_1(), 0, 64), - 'number' => substr($order->get_meta('billing_number'), 0, 15), + 'number' => preg_replace('/[^\d]+/', '', substr($order->get_meta('billing_number'), 0, 15) ), 'complement' => substr($order->getWcOrder()->get_billing_address_2(), 0, 64), 'zip_code' => preg_replace('/[^\d]+/', '', $order->getWcOrder()->get_billing_postcode()), 'neighborhood' => substr($order->get_meta('billing_neighborhood'), 0, 64), @@ -590,7 +590,7 @@ public static function build_customer_shipping_from_wc_order(WC_Order $wc_order) 'description' => $method, 'address' => array( 'street' => substr($shipping['address_1'], 0, 64), - 'number' => substr($shipping['number'], 0, 15), + 'number' => preg_replace('/[^\d]+/', '', substr($shipping['number'], 0, 15) ), 'complement' => substr($shipping['address_2'], 0, 64), 'zip_code' => substr(preg_replace('/[^\d]+/', '', $shipping['postcode']), 0, 16), 'neighborhood' => substr($shipping['neighborhood'], 0, 64),