Pages

Monday, April 14, 2014

Woocommerce change error message OR repalce default message - [resolved]

If you want to change default messages in woocommerce than you have to write below code in functions.php

function sagepay_woocommerce_add_error( $error ) {
    if( 'SagePay Direct - Card number required.' == $error ) {
        $error = 'Card number required.';
    } else if( 'SagePay Direct - Fullname required.' == $error ) {
        $error = 'Fullname required.';
    } else if( 'SagePay Direct - CV2 required.' == $error ) {
        $error = 'CV2 required.';
    }
    return $error;
}
add_filter( 'woocommerce_add_error', 'sagepay_woocommerce_add_error' );

No comments: