Note: We are unable to provide support for customizations under our Support Policy. If you need to customize a snippet or extend its functionality, we recommend working with a Woo Agency Partner or finding a WooCommerce developer on Codeable.
Currently, when using the Checkout block from the WooCommerce Blocks plugin, there’s no check if the billing or shipping address field contains a house number. The following code snippets allow to check if these fields contain a number.
You need to add code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update the theme.
Check if the shipping address contains a house number
↑ Back to topTo check if the shipping address contains a house number, please use the following code snippet:
Check if the billing address contains a house number
↑ Back to topTo check if the billing address contains a house number, please use the following code snippet:
Check if both the billing and the shipping address contain a house number
↑ Back to topTo check if both the billing and the shipping address contain a house number, please use the following code snippet: