Skip navigation

Эта тема содержит 0 ответов, имеет 1 голос.

Последнее обновление: henkO 7 месяцев назад.

При содействии: Kor.

Автор Записи
12 июля, 2024 на 4:52 пп #15943569

henkO

Background of the issue:
I would like to translate a text added in the function php. I've read that you need to provide the text with gettext function. This is the extra code in the function php:

//international posting cart message
function add_checkout_notice() {
}

add_action( 'woocommerce_review_order_before_submit', 'show_checkout_notice', 10 ); //remove if you do not want to show it on the checkout page

function show_checkout_notice() {

global $woocommerce;
$msg_states = array( 'AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GR', 'HR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'MC', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK' );

if( !in_array( WC()->customer->shipping_country, $msg_states ) ) {
echo ' Please Note: As we ship from the EU, International orders (outside the EU) may incur additional custom, VAT and tax charges for which we are not responsible for.';

}
}

?>

Symptoms:
I have no programming knowledge and don't know where to put the _() function.

Questions:
Can you help me understand where to put the _() function in my PHP code to translate the text?