I am not used to hooks in Wordpress and Woocommerce. I was wondering if it was possible to change an error notice text in Woocommerce using this dedicated filter hook:
add_filter('woocommerce_add_error', 'alter_check_for_afterpay', 100000);
function alter_check_for_afterpay($message) {
//kijk of er in de foutmelding het woord afterpay in staat
$find_afterpay = strpos($message, "AfterPay");
if($find_afterpay == true){
$message = "Helaas, is het niet gelukt om met AfterPay te betalen. U kunt uw order bestellen door ideal te gebruiken.";
doSomeThing();
}
return $message;
}
function doSomeThing(){
echo "Do something here";
}
I wanna do something when error is showing on the checkout page.