WC remove coupon already apply error

In the wocommerece checkout page if you don't want to show the message or warning 'Coupon code already applied!' or want to change this message you can apply wocommerece filter called 'woocommerce_add_error' and a custom function to remove or change the this default text message. As like other filter code this should also placed in the functions.php of your active theme. you can place this code anywhere in side the file best to put this code end of the file and use some comments that this is custom added code to prevent future inconvenience. Check this code below you can simply copy in your functions file and change change according to your needs.



<?php
// APPLY WC ADD ERROR FILTER
add_filter( 'woocommerce_add_error', 'my_woocommerce_add_error' );

/* HIDE MESSAGE 'Coupon code already applied!' - DALJEET */
function my_woocommerce_add_error( $error ) {
    if( 'Coupon code already applied!' == $error ) {
        // HERE CAN ADD YOUR CUSTOM MESSAGE AS WELL  
        $error = '';
    }
    return $error;
}
?>

Students Tech Life