For something as seemingly simple as setting up a terms & conditions page you would think that we wouldn't get many questions about it but we actually get quite a few questions.
Does WooCommerce Have a Terms & Conditions Page?
Yes of course we have a Terms & Conditions page. 🙂
If you set the Terms page under WooCommerce -> Settings -> Pages a checkbox will appear right next to the Place Order button at the bottom of the checkout process.
Okay I Have the Checkbox Showing Up? How Do I Change the Wording?
By default the checkbox says: “I have read and accept the terms & conditions”. If you want to change that since you're just tweaking one line I would recommend using the gettext filter.
How Do I Turn Off my WooCommerce Terms & Conditions Page?
Yes – I have received this question before. If you read the above description about setting up the t&c page it should be pretty obvious. You just need to unset the Terms page.
How Do I Check The Terms & Conditions Checkbox By Default?
I'm usually against pre-checking checkboxes but since most users won't read the terms and conditions does it matter? I'd probably leave it unchecked by default but if you want to check yours you should have that option.
I actually was surprised to not find a filter there so I went ahead an added one. Hopefully that get's pulled into WC 2.1 when that is released and then you can use this little plugin I created to turn on the checkbox by default:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/ | |
* Plugin Name: WooCommerce Check Terms & Conditions | |
* Plugin URI: https://gist.github.com/BFTrick/7789974 | |
* Description: Make the Terms & Conditions checkbox checked by default | |
* Author: Patrick Rauland | |
* Author URI: http://patrickrauland.com/ | |
* Version: 1.0 | |
* | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
* GNU General Public License for more details. | |
* | |
* You should have received a copy of the GNU General Public License | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |
* | |
* @author Patrick Rauland | |
* @since 1.0 | |
*/ | |
/ | |
* Always check the WC Terms & Conditions checkbox | |
* | |
* @since 1.0 | |
* | |
* @return bool | |
*/ | |
function patricks_wc_terms( $terms_is_checked ) { | |
return true; | |
} | |
add_filter( 'woocommerce_terms_is_checked', 'patricks_wc_terms', 10 ); | |
add_filter( 'woocommerce_terms_is_checked_default', 'patricks_wc_terms', 10 ); |
Can the Terms & Conditions Page Open in a Pop Up?
Now this is a good question! By default the Terms & Conditions page opens in a new window (so users don't lose where they are in the checkout process). Opening in a new window is okay but I can certainly see how opening up the terms & conditions page in a lightbox would be preferable from a design perspective. I did a quick Google search and wasn't able to turn up anything. If you're interested in this please contact me.
Update 2014/10/31: After getting a ton of mail asking me to build this I finally did. See my announcement post about the WooCommerce Terms & Conditions Popup.
Terms & Conditions For Everyone
Hopefully this answers some of the questions you may have about how WooCommerce handles the terms & conditions page. If not let me know if the comments. 🙂
Would you know what filter to use with the gettext method to change the wording of terms and conditions? Where do you see a list of all these filters?
Hey Rebecca, you can actually just override the
/templates/checkout/review-order.php
file which might be easier. Or if you did want to use the gettext filter you could translate both:I have read and accept the
andterms & conditions
strings.There isn’t a list of all of the filters in WooCommerce since there’s a ton. We do have the more important hooks listed here: http://docs.woothemes.com/document/hooks/
Hi Patrick,
Thank you for the “T&C Checked” plugin.
Can you please give instructions on where to upload your file and what should be changed in “review-order.php”?
Basically, my question is – how to install this trick 🙂
Thanks
Ido
Hi Ido – it’s a plugin so you can upload that file to the
/wp-content/plugins/
directory. Easy piesy.This is exactly what I was looking for! Thanks so much for the detail, and especially for sharing!
woocommerce_terms_is_checked is not working for new version of woocommerce.
now,you can use:woocommerce_terms_is_checked_default
Hey Jack! You’re totally correct. I’ve updated the plugin with an extra line so it will work with WooCommerce 2.0 & 2.1. Thanks again. 🙂
Hi Patrick,
Something like http://wordpress.org/plugins/simple-popup-plugin/ can be used to make a pop up.
Cheers,
Gabriel
Thanks – but can this make an existing link (which we can’t easily add a shortcut to) open in a popup?
Quoting some clever person 😉 from a comment above:
“you can actually just override the /templates/checkout/review-order.php file which might be easier.”
Just add
onclick="return popitup(this.href, 960, 500);"
at line 179 ( for WooCommerce 2.1.16)So
a href="%s" rel="nofollow"
becomesa href="%s" rel="nofollow" onclick="return popitup(this.href, 960, 500);"
Thanks! 😀
So are we going to apply this tip every time an update gets pushed through to our sites?
Is there a way to have the term & conditions show up only for certain products? We will be adding a rental product that we need terms & conditions for but no other products.
It’s definitely possible. You’d want to write a custom filter for the
woocommerce_checkout_show_terms
hook and in that filter you’d want to check product IDs and see if one of the specified IDs is in the list and then return true; otherwise return false.I wish I could spend the time to customize this for you. Unfortunately I’m a bit busy with other things at the moment. You can probably get it done at Codeable pretty inexpensively and very quickly.
I hope that helps! 🙂
Thank you, I’ll check it out.
Patrick,
I had code written to have terms & conditions only appear for the one product I need it for but with the updated woocommerce it no longer works and terms & conditions is showing up again for all products. You would think this would be something woocommerce would write into the settings. Do you have any suggestions that won’t cost me hiring someone to write a work around again?
A function was probably deprecated. 🙁 If you turn on error reporting you should see the deprecated error message. And usually it should even point you to a new function.
Unfortunately, that was not very helpful. Perhaps I just don’t know how to read the error log but I couldn’t find anything useful in it. Thank you for trying. It may be my warped opinion but I really think it should be an option in woocommerce. We can’t be the only company out there who need a T&C on only certain products.
If you are still in need of this, I used this plugin: https://wordpress.org/plugins/woocommerce-show-hide-terms-and-conditions/
Hey Partric. Thanksf for the helpful info. I have a different issue with woocommerce. We need to write name, address and order total of the customer to terms and conditions form. We can put a static terms & cond page but how can we make it include customer info?
Thanks
Hey Kadir,
Yea that’s totally different. I have heard of use cases like this. There is an upcoming WooCommerce extension for ApproveMe that should be able to handle more intense terms and conditions.
Hi Patrick,
Since WooCommerce updated their template files in version 2.3.0 the
review-order.php
file has changed a bit. I used to be able to customize the term and conditions link there (e.g. make bold, change color). Now I can’t, that whole section of code is gone and I don’t know where it went.Can you offer any advice?
Hey Dustin,
In WooCommerce 2.3 the
review-order.php
template was separated intoreview-order.php
andpayment.php
. You can still modify the Terms & Conditions section in the payment.php file.Patrick, you rock. Plain and simple. Thanks so much man!
Is it possible, or is there a plugin where i can put a second checkbox (age verification) there?
I don’t know about adding a second checkbox but there is Age Verify plugin that prevents those who are too young from seeing the site at all. I haven’t used it but it’s very highly rated (and free) on WordPress.org
When the customer accepts the “Terms” does it store the value anywhere? If not, having it stored in the order would be great.
It doesn’t store any record that they confirmed the T&C. But they shouldn’t be able to checkout without accepting the T&C. There is a post by Remi that shows you how to store T&C in the database.
Patrick,
This may be a bit off topic but do you know if it is possible to have WooCommerce pick a T&C page from a custom post type?
We like to keep all the legal pages under a legal CPT.
That’s not possible. You can only pick pages. You’d have to customize it to pick a custom post type. Shouldn’t be too hard though. I’d reach out to Codeable.
Hi Patrick
Is it possible for a checked Ts & Cs agreement to be unchecked if a user amends the page after checking the box? (I’ve just had a lawyer – of course! – ask me that question about a site that I didn’t build but which uses WooCommerce.) Would be very grateful for any hints.
Bahi
Hi Patrick,
How can I make the terms and condition checkbox optional?
Thanks
Hi Patrick,
I have a question, in my counrty web-site must add customer info, order info, seller info etc. to terms&conditions. It is a legal must. Thus my terms page must be dynamic and must change on every order? Do you have any idea about this?
Thnx
I’m sure you could customize it if you want.
Have you seen my post about Codeable for work like this?
I just thought I can do it on my own. anyway.
Hi, please can you post the full code gettext example to use in functions.php that will allow us to change the text to the terms and conditions check box, I cant find it anywhere…
Im sure many pthers are also searching for this….
It’s not in the functions.php file, it’s in the terms.php file
Is there a way to highlight the terms and conditions check box? Even when the message comes up that the customer must check it, the box is so hard to see that they are probably scrolling up and down the page wondering what in the world they missed.
It really worked man. Thanks