Storing WooCommerce Terms & Conditions in the Database

WooCommerce provides a nice feature that force your customers to accept your terms and conditions if you define the corresponding page within WooCommerce settings. If your customers don’t check the “terms and conditions”, they can’t proceed the order. This is nice and easy to setup.

Setup the Terms & Conditions Page

Just a quick reminder on how to set this up. First of all, create a new page, call it “Terms” (or what you want!), add your content, then go to WooCommerce > Settings > Checkout in WC 2.1.x or to WooCommerce > Settings > Pages for versions below 2.1. Then choose the page you just created in the corresponding dropdown select and save settings.


And here is what your customers will see on the checkout page:


Nice but…

That’s pretty neat right? But what happens when one your customer has a litigation with you? Can you prove that your customer accepted your terms and conditions? The answer is not that simple. You can still say that it’s impossible to purchase on your site without accepting your terms and conditions, but legally, it is not enough.

The solution, is to add a snippet to your site that will store the “terms and conditions” field value within the database, and in that case you can prove that terms and conditions were accepted, order by order.

Simply add this code to the functions.php file within your theme folder:

This code will store the field value within the database, and will also print this information on the “edit order” page:


13 responses to “Storing WooCommerce Terms & Conditions in the Database”

  1. elliot

    This is fantastic. Have you considered proposing this to the WC team?

    1. I’ll probably do a pull request very soon!

  2. pavnish

    Hi Remi .. can i add two featured image in my woocommerce theme….

    1. to make it short: you can’t. The only workaround would be to use the attachment loop.

  3. tosun

    Thanks for your sharing, it is useful.
    But, I ask you some more point about this subject.
    It is good idea to store at database and show at order.
    But, I want to add some shortcodes to term&cond. page like below ;
    [customer-name] , [customer-address] , [woocommerce-order-date] ,[woocommerce-shipping-name] , [woocommerce-shipping-address], [woocommerce-shipping-phone] , [woocommerce-shipping-mail]

    How can I do this?

  4. rohilmistry

    What if I want to make it editable field in the backend ? So that admin can modify it just like Billing Address.

    I meant when you click edit icon on right hand side of BILLING ADDRESS, then it will show you a form so is that possible to achieve the same for the custom field.

  5. videomicloud

    I know this is an old post…but it addresses exactly what my client needs, which is to store some sort of proof that customers agreed to the terms and conditions. I”ve implemented the code using the code snippets plugin (which works great for a couple other functions file customizations)…but I can’t get this to work. My guess is because of changes in Woocommerce core since this was first posted. So guess I’m asking if this method still works to your knowledge? If it does..I’m currently testing this site before going live and using’s sandbox mode. Could that possibly cause things to not work?? Thanks…I’m an experienced WordPress developer but self-taught with PHP programming. I can do simple stuff typically.

    Chris Blair

  6. tosun

    This snippet is very useful.
    But, how can we show this field at customer’s order details page, as well.
    Best regards

    1. you can do it using the woo_display_terms_and_conditions_status() function wherever you want.

Leave a Reply