This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
Tagged: Bug, Compatibility
This topic contains 5 replies, has 2 voices.
Last updated by Bruno Kos 1 year, 8 months ago.
Assisted by: Bruno Kos.
Author | Posts |
---|---|
March 27, 2023 at 8:52 am #13335793 | |
Jerzy Afanasjew |
Tell us what you are trying to do? I am trying to understand why my payment gateway plugin redirection to external payment gateway doesn't work when I switch currency using WCML currency switcher, but does work when I relay on geolocation (and don't change the country at checkout, that breaks redirection too). Is there any documentation that you are following? As far as I was able to investigate, both WCML and my payment plugin use $currency function. I want to determine can I simply rename this function or if perhaps WCML uses a different mechanism to switch currency when using geolocation feature. If it does, I need to force that behaviour upon switcher use. What is the link to your site? hidden link (use the checkout country field to switch between US and France to see the issue, the problematic gateway is Przelewy24). |
March 29, 2023 at 1:06 pm #13358311 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
Hi, Thank you for contacting WPML support! So to confirm, the issue is with "WooCommerce Przelewy24 Payment Gateway" only, while other gateways work properly? Can I ask you to reach out their developers see about this and get back to us with their feedback, in case they provide one? Because have a look at this, it seems like that this plugin already has other unsolved issues with WPML. https://wpml.org/forums/topic/product-translations-not-showing-after-update/#post-10810101 So this may not be the only issue you will encounter and given that payment gateways are typically complex plugins, we will need to have their cooperation in order to get this fixed, all of which goes through our https://wpml.org/documentation/support/go-global-program/. Regards, |
March 30, 2023 at 7:48 am #13363841 | |
Jerzy Afanasjew |
I tried reaching to developers of the plugin, they told me "its open source, fix it yourself". That's why I am desperately looking for a workaround. With currency geolocation activated payment redirection works, however google search results crawler gets prices in USD. Perhaps there is a workaround at least to fixt that part? Can I ask google crawler to get prices in PLN, to crawl from Polish IP for google.pl ? |
March 30, 2023 at 8:18 am #13364241 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
Hi, You may try that, because we are aware of it but without a solution: Or perhaps do try the above, as suggested by developers in the internal ticket which covers the above case. You could however also seek help from our https://wpml.org/contractors/. Regards, |
March 30, 2023 at 2:29 pm #13368321 | |
Jerzy Afanasjew |
Please explain how does the "Allow the overriding of the WCML geolocated country." function works, I have trouble understanding it. Thank you. |
March 31, 2023 at 1:04 pm #13376049 | |
Bruno Kos Supporter
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+01:00) |
Hi, How to work with this hook is beyond our support scope, but the general idea may be the following: - Detect Google bot Something in these lines but this has not been tested: add_filter( 'wcml_geolocation_get_user_country', function ( $userCountry, $allCountries ) { $u_agent = $_SERVER['HTTP_USER_AGENT']; if ( preg_match( '/google/i', $u_agent ) ) { //detect if googlebot user agent $id = url_to_postid( $_SERVER["REQUEST_URI"] ); //get the ID of the current post if ( is_numeric( $id ) && $id !== 0 ) { $langToCountry = [ 'pl' => 'PL', 'ar' => 'AE', 'en' => 'US', //... ]; $my_post_language_details = apply_filters( 'wpml_post_language_details', null, $id ); //get language details of the ID $lang = $my_post_language_details["language_code"]; $googleCountry = isset( $langToCountry[ $lang ] ) ? $langToCountry[ $lang ] : null; if ( $googleCountry ) { return $googleCountry; } } } return $userCountry; }, 10, 2 ); but this is as far as we can help with this, everything else will need to be managed by our https://wpml.org/contractors/. But there is one thing - I do however see that Przelewy24 Gateway is supported by https://woocommerce.com/woocommerce-payments-p24/. Did you try with this? Is that payment not the part of the https://woocommerce.com/products/woocommerce-payments/? Regards, |