Untitled
unknown
plain_text
2 years ago
1.5 kB
10
Indexable
function custom_text_change_script() {
if ( is_checkout() ) {
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
// Función para realizar la corrección de texto y mostrarlo después
function performTextCorrection() {
// Reemplaza el texto en el bloque de revisión del checkout
var textToReplace = "Inserisci la larghezza (m):";
var newText = "Larghezza:";
var $elements = $('.woocommerce-checkout-review-order-table .product-name strong:contains("' + textToReplace + '")');
// Oculta el texto original
$elements.each(function() {
$(this).css('display', 'none');
});
// Realiza la corrección de texto y muestra el nuevo texto
$elements.each(function() {
$(this).text($(this).text().replace(textToReplace, newText));
$(this).css('display', 'inline'); // Muestra el nuevo texto
});
}
// Ejecuta la corrección de texto después de la actualización del bloque de revisión del checkout
$(document.body).on('updated_checkout', performTextCorrection);
});
</script>
<?php
}
}
add_action('wp_footer', 'custom_text_change_script');
Editor is loading...