Skip to content

Instantly share code, notes, and snippets.

@acanza
Created November 2, 2017 19:46
Show Gist options
  • Select an option

  • Save acanza/b8a998a4900a81cef8934b87a092991c to your computer and use it in GitHub Desktop.

Select an option

Save acanza/b8a998a4900a81cef8934b87a092991c to your computer and use it in GitHub Desktop.
Personaliza el texto por defecto en la página de pedido recibido de WooCommerce
// Personaliza el texto por defecto en la página de pedido recibido de WooCommerce
if ( in_array( 'woocommerce/woocommerce.php', get_option( 'active_plugins' ) ) ){
add_filter( 'gettext', 'customize_default_text_in_thank_you_page', 20 );
function customize_default_text_in_thank_you_page( $translated ) {
$text = array(
'Texto original 1' => 'Nuevo texto 1',
'Texto original 2' => 'Nuevo texto 2'
);
// Comprueba que la página sea la de pedido recibido
if ( is_wc_endpoint_url( 'order-received' ) ) {
$translated = str_ireplace( array_keys($text), $text, $translated );
}
return $translated;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment