Skip to content

Commit

Permalink
fix: remove non-numeric characters from 'number' field
Browse files Browse the repository at this point in the history
  • Loading branch information
gutobenn committed Jan 3, 2025
1 parent 284074f commit c88261a
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit c88261a

Please sign in to comment.