In this example, I will demonstrate how to hide the “billing phone” if “billing company” is empty or no information is entered. Of course, you also have to disable the mandatory attribute for the billing phone from the Customizer settings, otherwise checkout validation will fail. You can readapt this snippet to any other checkout field combo – just identify the input IDs and change jQuery accordingly. Enjoy!
In this example, we will see how to hide and keep hidden the Billing Phone entire field unless some content is entered inside Company name field
PHP Snippet: Toggle a Checkout Field Based on Whether Another Field is Empty