Note: This is a Developer level doc. If you are unfamiliar with code/templates and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our Support Policy.
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.
To check if the shipping address contains a house number, please use the following code snippet:
To check if the billing address contains a house number, please use the following code snippet:
To check if both the billing and the shipping address contain a house number, please use the following code snippet: