Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WooCommerce edit error message on checkout page

I see WooCommerce gives an error message (You must accept our Terms & Conditions.), if someone not checked the "terms" check box (in the checkout page).

How I change/edit the error message?

like image 338
Niladri Banerjee - Uttarpara Avatar asked Oct 29 '13 12:10

Niladri Banerjee - Uttarpara


People also ask

How do I change the position of WooCommerce error messages on checkout page?

To edit the location of the checkout errors you must do the following: Set SCRIPT_DEBUG constant to true, do it in the wp-config. php file define('SCRIPT_DEBUG', true); Locate the checkout. js script in the woocommerce/assets/js/frontend Locate wc_checkout_form.

How do I change the error message in WooCommerce?

From the dashboard menu, click on the Appearance Menu > Theme Editor Menu. When the theme editor page is opened, look for the theme functions file with the extension functions. php. Open this functions file to add the function to show only one error message for the WooCommerce checkout field.

How do I get rid of additional information text in WooCommerce checkout?

All you need to do is install a plugin like YITH WooCommerce Tab Manager and activate it. Once active, use the plugin options to remove, change or delete the WooCommerce tabs. You can even create your custom tab. The benefit of using this method is that is the most simple and the most beginner-friendly.


1 Answers

You can do this with the woocommerce_add_error filter. Add the following to your functions.php file.

// alter the subscriptions error
function my_woocommerce_add_error( $error ) {
    if( 'The generic error message' == $error ) {
        $error = 'The shiny brand new error message';
    }
    return $error;
}
add_filter( 'woocommerce_add_error', 'my_woocommerce_add_error' );
like image 116
Andy Avatar answered Nov 07 '22 22:11

Andy