Checkout: remove white space in postcode
-
Hi All,
I am trying to remove the white space in the postcode field on the checkout page of my Woocommerce site. Because in the back-end an order will show the postcode for example as: 2634 TY, but it needs to show: 2634TY, without the white space between the letters en the numbers.
I imagine it can be done in PHP, but unfortunately I am no expert. I have searched on Google and found pieces of code that I have put together, but to no avail. This is what I came up with but it doesn’t work:
add_action( 'woocommerce_checkout_process', 'remove_spaces_in_postcode', 10, 0); function remove_spaces_in_postcode() { $billing_postcode = preg_replace('/\\s+/', '', $_POST['billing_postcode']); return $fields; }
Hopefully somebody knows the correct code.
Hope you can help me.
Best.
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Checkout: remove white space in postcode’ is closed to new replies.