Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove non-numeric characters from 'number' field #525

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Helper/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down
Loading