简体   繁体   中英

How to edit terms & conditions checkbox text in Woocommerce checkout?

In previous versions of WooCommerce, it was possible to make changes in Admin Customize > Woocommerce, but now this options has disappeared.

Where can I change this text?

Great answer from LoicTheAztec. However, I just wanted to add that this no longer needs to be done programmatically. You can edit it from the Customizer (Appearance > Customizer). Just navigate to Woocommerce > Checkout and scroll down to the bottom.

在此处输入图像描述

NOT SEEING THIS IN THE CUSTOMIZER?

There is a bit of a known bug with Woocommerce detailed here ( https://github.com/woocommerce/woocommerce/issues/28606 ) where some users are not able to see this in the customizer. To fix it, simply follow the steps.

  1. Unset the terms and conditions page.
  2. Publish changes
  3. Close and reopen the customizer (Refresh might work)
  4. Reset the terms and conditions page
  5. Wallah, the editable text box should now appear

That's all folks. Of course, if you're still having issues, try the other programming solutions or make sure you are using up-to-date versions of Woocommerce and WordPress.

To edit terms and conditions displayed text in checkout, you can use the following hooked function, editing the text inside it:

add_filter( 'woocommerce_get_terms_and_conditions_checkbox_text', 'custom_terms_and_conditions_checkbox_text' );
function custom_terms_and_conditions_checkbox_text( $text ){
    $text = get_option( 'woocommerce_checkout_terms_and_conditions_checkbox_text', sprintf( __( 'I have read and agree to the website %s', 'woocommerce' ), '[terms]' ) );

    return $text;
}

Code goes in functions.php file of the active child theme (or active theme). Tested and works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM