Skip to content

Instantly share code, notes, and snippets.

@joseconti
Created July 24, 2024 16:28
Show Gist options
  • Save joseconti/487e3b6f191fdeff64c0a031d8d12a88 to your computer and use it in GitHub Desktop.
Save joseconti/487e3b6f191fdeff64c0a031d8d12a88 to your computer and use it in GitHub Desktop.
Para cambiar el mensaje que se envía cuando una tarjeta va a caducar. WooCommerce Redsys Gateway
<?php
add_filter( 'redsys_send_expired_credit_card_email', 'custom_redsys_send_expired_credit_card_email' );
function custom_redsys_send_expired_credit_card_email( $data ) {
// Obtener el nombre y apellido del usuario
$user_id = $data['user_id'];
$nombre = get_user_meta( $user_id, 'billing_first_name', true );
$apellido = get_user_meta( $user_id, 'billing_last_name', true );
$payment_methods_url = wc_get_endpoint_url( 'payment-methods', '', wc_get_page_permalink( 'myaccount' ) );
// Personalizar el asunto del correo
$data['subject'] = 'Tu tarjeta va a caducar en breve';
// Personalizar el mensaje del correo
$data['message'] = '<html><body>';
$data['message'] .= 'Hola ' . esc_html( $nombre ) . ' ' . esc_html( $apellido ) . ',<br />';
$data['message'] .= 'Hemos detectado que tu tarjeta está apunto de caducar, debes actualizarla.<br />';
$data['message'] .= '<a href="' . esc_url( $payment_methods_url ) . '">Actualizar información de pago</a>';
$data['message'] .= '<br />Muchas gracias.';
$data['message'] .= '</body></html>';
return $data;
}
@joseconti
Copy link
Author

Este código solo sirve para mi plugin WooCommerce Redsys Gateway

https://plugins.joseconti.com/product/plugin-woocommerce-redsys-gateway/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment