WooCommerce displays the terms and conditions acceptance checkbox on the payment form of the checkout page. The checkbox field is a requirement before placing an order. If a customer wants to read the terms and conditions, it is displayed in the small area of the payment form. As a result, it is hard to read and scroll through. This tutorial will show you how to open the WooCommerce terms and conditions link in a new tab on the checkout page.
WooCommerce Terms and Conditions Checkbox
WooCommerce uses an accordion effect to display the terms and conditions on the checkout page. The area expands when clicking the terms and conditions link. Consequently, this makes the WooCommerce terms and conditions difficult to read and may frustrate customers.
A better solution is to have the link open in a new tab. Moreover, opening a separate tab is essential if you are using a third-party company to generate your privacy policy and terms and conditions.
Copy and paste the following PHP code snippet into the functions.php file of your active parent theme or child theme.
The PHP code snippet does two things. First, it removes the accordion effect from the terms and conditions checkbox field. This is done by unhooking the function wc_terms_and_conditions_page_content from the action woocommerce_checkout_terms_and_conditions. Secondly, the code snippet will force the terms and conditions link to open in a new tab.
Final Thoughts
If you populate the terms and conditions page on your website with Javascript, the content will not display within the accordion area on the checkout page. This is due to the content being filtered by WordPress for security reasons. As a result, you will need to have the WooCommerce terms and conditions link open in a new tab.
Need help? Our WordPress Development Service is a comprehensive solution for small, medium, and enterprise-level businesses. Call us at 602-633-4758 for a free consultation.
Worked perfectly, exactly as it is. Brilliant.
Thank you for sharing and it works with me too. How about the privacy policy to open in new tab also?
Is it possible to get the terms and conditions at the checkout page open at the checkout page without clicking?
For eg. as shown in the screenshot from this link https://ibb.co/hZbyW7w.
Thank you.
I don’t get it. This is useful to know about the ‘woocommerce_checkout_terms_and_conditions’ hook, but where is ‘golden_oak_web_design_woocommerce_checkout_terms_and_conditions’ defined?
Oh, it’s literally there in the script:
function golden_oak_web_design_woocommerce_checkout_terms_and_conditions() {
remove_action( ‘woocommerce_checkout_terms_and_con…
Sorry. I’m just blind.
Funcionou perfeitamente. Muito obrigado pela ajuda e informação valiosa!
Thank You!
this solution is very helpful thanks