Skip to content

Instantly share code, notes, and snippets.

@deivamagalhaes
Created June 26, 2020 21:19
Show Gist options
  • Save deivamagalhaes/f509201999c53b56b6a23256200e76db to your computer and use it in GitHub Desktop.
Save deivamagalhaes/f509201999c53b56b6a23256200e76db to your computer and use it in GitHub Desktop.
Customize AVS mismatch error message
<?php
add_filter( 'wc_payment_gateway_transaction_response_user_message', 'sv_customize_avs_mismatch_message', 10, 3 );
/**
* Customize AVS mismatch error message.
*
* @param string $message message to show to user
* @param string $message_id machine code for the message, e.g. card_expired
* @param SV_WC_Payment_Gateway_API_Response_Message_Helper $helper helper instance
*/
function sv_customize_avs_mismatch_message( $message, $message_id, $helper ) {
if ( 'avs_mismatch' === $message_id ) {
$message = esc_html( 'The provided address does not match the billing address for the cardholder. Please contact us.' );
}
return $message;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment