Created
May 16, 2026 13:21
-
-
Save DmitryBychenko/1eb88e8eff6731bc91d636e4ace54f69 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Способ 2: Изолированный фильтр gettext для WooCommerce | |
| * Используется как запасной вариант для тем с кастомной структурой шаблонов. | |
| */ | |
| add_filter( 'gettext', 'tb_classic_heavy_cart_strings', 20, 3 ); | |
| function tb_classic_heavy_cart_strings( $translated_text, $text, $domain ) { | |
| // Мгновенно отсекаем проверку строк вне WooCommerce и в админке | |
| if ( is_admin() || 'woocommerce' !== $domain ) { | |
| return $translated_text; | |
| } | |
| // Перехватываем оригинальные английские исходники строк | |
| switch ( $text ) { | |
| case 'Proceed to checkout': | |
| case 'Proceed to Checkout': | |
| return __( 'Выложить из Корзины и Оплатить', 'techbear-custom' ); | |
| break; | |
| case 'Update cart': | |
| case 'Update Cart': | |
| return __( 'Пересчитать товары в Корзине', 'techbear-custom' ); | |
| break; | |
| case 'View cart': | |
| case 'View Cart': | |
| return __( 'Посмотреть что в Корзине', 'techbear-custom' ); | |
| break; | |
| } | |
| return $translated_text; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment