Skip to content
Advertisement

Add custom checkout fields below the terms and conditions in Woocommerce

I have built an e-commerce site using Woocommerce. I would like to add two more check boxes below the terms and conditions. I have searched everywhere for a working solution and the only thing that I found is a commercial plugin.

How to add custom checkout fields (2 checkboxes) below the terms and conditions programmatically?

Location of the terms and condition screenshot:

The two checkboxes below the terms and conditions

Advertisement

Answer

  • The 1st hooked function displays the 2 additional checkout fields
  • The 2nd hooked function will check that both checkboxes are “selected” to allow checkout, displaying a custom error notice if not…

The code:

JavaScript

Code goes in function.php file of your active child theme (active theme).

Tested and works.

enter image description here

enter image description here

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement