From 3c3510684d2366aea50418eaee3f0667c9bd9c5b Mon Sep 17 00:00:00 2001 From: seregawerewolf <42439012+seregawerewolf@users.noreply.github.com> Date: Tue, 21 Feb 2023 21:21:29 +0200 Subject: [PATCH] fix ukrainian language on payment page Wordpress use country code ISO 639-1, ukrainian language have code uk, but API use value ua for parametr 'language'. This fix on function getLanguage() replace uk on ua if the blog has language ukraininan. --- woocommerce-gateway-wayforpay.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/woocommerce-gateway-wayforpay.php b/woocommerce-gateway-wayforpay.php index 6c419c4..e8c8e32 100644 --- a/woocommerce-gateway-wayforpay.php +++ b/woocommerce-gateway-wayforpay.php @@ -463,9 +463,13 @@ private function getCallbackUrl($service = false) private function getLanguage() { - return substr(get_bloginfo('language'), 0, 2); - } - + $lang_uk = substr(get_bloginfo('language'), 0, 2); + + if ($lang_uk === 'uk') { + $lang_uk = 'ua'; + } + return $lang_uk; + } protected function isPaymentValid($response) {