Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
When using WooCommerce with the PluginHive 'Multi-Carrier Shipping Method for WooCommerce' plugin and WPML, USPS international shipping methods are not offered for customers with international shipping addresses selecting the Spanish language. This issue arises because the translation of the country name includes accents, such as g 'Canada' to 'Canadá', leading to an invalid country name error (error code -2147218046) from USPS.
Solution:
The issue primarily stems from the PluginHive plugin rather than WPML, as similar issues would occur in a Spanish WooCommerce setup without WPML. The PluginHive developers are aware and plan to address this in their next release. If immediate resolution is necessary, consider implementing custom code using the

wpml_switch_language

hook to ensure the correct country name is used in API requests.

If this solution does not resolve your issue or seems outdated, please check for related known issues at https://wpml.org/known-issues/, verify you have the latest versions of your themes and plugins, and consider opening a new support ticket for further assistance at WPML support forum.

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: 

This topic contains 3 replies, has 2 voices.

Last updated by Dražen Duvnjak 2 months, 3 weeks ago.

Assisted by: Dražen Duvnjak.

Author Posts
June 26, 2024 at 7:52 pm #15836994

calebW-2

Background of the issue:
We are using WooCommerce and the PluginHive 'Multi-Carrier Shipping Method for WooCommerce' plugin. We have an issue where none of our configured USPS international shipping methods are offered when a customer with an international shipping address selects the Spanish language using the WPML plugin. I turned on debug mode for the shipping plugin and see the response for the USPS international methods is error code -2147218046, Invalid Country Name. I am using Canada as a test shipping address and noticed WPML changes the country name from 'Canada' to 'Canadá' where the last 'a' is accented.

Symptoms:
USPS international shipping methods are not offered when the Spanish language is selected, and the response shows error code -2147218046, Invalid Country Name.

Questions:
Can WPML be modified to use the English country name when creating the request for USPS?
Could we somehow set WPML to always use the English Country name shipping/API rate purposes, even if the user on the front end selects, say "Italia" instead of "Italy" or "Canadá" instead of "Canada" – in the backend, it would submit the English name? This might not be possible! We do have a ticket in to PluginHive asking about this, but we wanted to write to you all in case just to find out if anything might be possible on the WPML side of things. Thanks so much!

June 27, 2024 at 7:07 am #15841150

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for contacting us.

This is an issue with that plugin noz WPML since the same issue would happen if you were having a website without WPML, in Spanish. WooCommerce would still use Canada with an accent since that is a translation in WooCommerce for that country and etc. So I believe this should be done in the plugin itself, to take correct country names and convert them to the values they support.

As for the WPML side, the best you can do is re-translate these country names, but that would also apply to other settings on your website which I do not recommend. Another way is custom code, but as said this would be the same code even without WPML, so there is not much we can advise other than maybe when creating custom code, to use wpml_switch_language hook to apply the query to the correct language.

Regards,
Drazen

June 27, 2024 at 7:16 pm #15846240

calebW-2

Hi Dražen Duvnjak!

This is a perfect reply and just what we needed – thank you!

We are, indeed, in touch with the PluginHive developers and they are planning to work as solution in on their next release for mid-July.

Thank you, again, for your quick and kind support, and I think we are good to go!

Thank you, Dražen! 🙂

June 28, 2024 at 6:00 am #15849288

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello Caleb,

thanks for getting back.

I am glad to hear my reply helped you!

I will be closing this ticket now, feel free to contact us again if any issues or doubts.

Kind regards,
Drazen

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.