Skip Navigation

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

Problem:
The client is experiencing an issue where the WooCommerce Gift Cards plugin sends notification emails in Greek regardless of the site language from which the gift card was purchased. Previously, a snippet was used to solve this, but it now causes a fatal error.
Solution:
We recommended updating the functions.php file with the following code:

$option_key = 'woocommerce_gift_card_received_settings';
add_filter( 'option_' . $option_key, [ wpml_st_load_admin_texts(), 'icl_st_translate_admin_string' ] );

Additionally, we advised adding the following XML configuration to the WPML-> Settings-> Custom XML tab to ensure proper translation management:

<wpml-config>
  <admin-texts>
    <key name="woocommerce_gift_card_received_settings">
      <key name="subject"></key>
      <key name="heading"></key>
      <key name="intro_content"></key>
      <key name="additional_content"></key>
    </key>
  </admin-texts>
</wpml-config>

We asked the client to verify if the last email is translated correctly by checking their WPML plugin log.

Please note that this solution might be outdated or not applicable to your specific case. If this solution does not resolve your issue, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket.

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.

No supporters are available to work today on this forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Tagged: 

This topic contains 27 replies, has 2 voices.

Last updated by Osama Mersal 2 months, 4 weeks ago.

Assisted by: Osama Mersal.

Author Posts
July 5, 2024 at 1:02 pm #15898633

nikolaosM

Hintergrund des Themas:
Hello,

We are facing an issue that we had solved in the past with the use of snippet that causes problems now. We have added the Woocommerce Gift Cards plugin whitch adds some new emails. The problem we are facing is that we have the default mail strings in Greek and have translated them, using string tranlation, in English. When someone buys a gift card from the Greek site the gift card receiver gets the notification in Greek, but when someone buys a gift card from the English site the gift card receiver gets notified in Greek again. We want the emails to be sended according to the site the gift card was bought from.

What we had active in the past is this snippet:

$option_key = 'woocommerce_gift_card_received_settings';
add_filter( 'option_' . $option_key, [ wpml_st_load_admin_texts(), 'icl_st_translate_admin_string' ] );

This now returns this error:

[Thu Jul 04 11:08:27.710899 2024] [proxy_fcgi:error] [pid 3721:tid 139887596521216] [client 2a02:85f:ec7f:f401:f44e:730d:cf86:543b:0] AH01071: Got error ’PHP message: PHP Fatal error: Uncaught Error: Call to undefined function wpml_st_load_admin_texts() in /home/997607.cloudwaysapps.com/tnzzdfsupc/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(582)

This is the older ticket we had oppened related to this issue. The problem is that it escalated to a ticket after chating with support, so we do not have the exact logs.

Is there a new way to fix this?

Thanks!

Die Symptome:

Fragen:

July 7, 2024 at 9:59 am #15906914

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Thanks for contacting WPML forums support. I'll be glad to help you today.

First of all, sorry for the late reply; it was due to a higher workload.

Please log in to this sandbox site and install the "Woocommerce Gift Card" plugin. (hidden link)

After that, please try to replicate the issue. Please let me know the steps to replicate it to consult our compatibility team, if it is replicable.

Best regards,
Osama

July 8, 2024 at 10:10 am #15912219

nikolaosM

Hello Osama,

I have added the plugin, made an order but I did not receive any emails. Are the emails active in this site? I have also made the string translations as our site has, but i was not able to receive any emails. Please check it out.

Thanks!

July 8, 2024 at 10:14 am #15912257

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Please check the emails using the mail log plugin. (hidden link)

Best regards,
Osama

July 8, 2024 at 11:08 am #15912520

nikolaosM

Do I have to set up wp mail? With what credentials? Mine?

July 8, 2024 at 11:14 am #15912558

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Just use this login URL: hidden link

After that, please click on the WP mail logging to check the mail.

Best regards,
Osama

2024-07-08_14-13-35.jpg
July 8, 2024 at 11:34 am #15912696

nikolaosM

It respondes with no emails found. I have made an order and got redirected in the thank you page. Still no emails.

July 8, 2024 at 11:55 am #15912824

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Please try to create a new order and check if the mail log works correctly. (hidden link)

I placed two orders, and the emails appeared correctly, but I didn't see the gift emails, so please let me know the steps to send them.

Best regards,
Osama

July 8, 2024 at 12:09 pm #15913039

nikolaosM

I can see your order emails. You have to make a new order with a gift card and fill all the fields including the To field with a valid email address. After that mark the order as completed to receive the gift card email.

July 8, 2024 at 12:48 pm #15913257

nikolaosM

I was able to recreate the issue in the sandbox. You can see that I make an order for a gift card from the Greek and the English site, but both gift card received emails are in Greek. hidden link

July 8, 2024 at 1:11 pm #15913357

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Thanks for replicating the issue. I'll consult our compatibility team and update you as soon as they reply.

Best regards,
Osama

July 8, 2024 at 1:16 pm #15913394

nikolaosM

You can just ask them why the snippet I have sended is causing problems and what can I use to replace it and fix the problem. I hope this will not take a month like last time.

July 8, 2024 at 1:28 pm #15913428

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

I added the following code to the functions.php file.

$option_key = 'woocommerce_gift_card_received_settings';
add_filter( 'option_' . $option_key, [ wpml_st_load_admin_texts(), 'icl_st_translate_admin_string' ] );

After that, I added the following code to WPML-> Settings-> Custom XML tab.

<wpml-config>
  <admin-texts>
    <key name="woocommerce_gift_card_received_settings">
      <key name="subject"/>
      <key name="heading"/>
      <key name="intro_content"/>
      <key name="additional_content"/>
    </key>
  </admin-texts>
</wpml-config>

Please check the last email and let me know if it's translated correctly. (hidden link)

Best regards,
Osama

July 9, 2024 at 7:49 am #15918651

nikolaosM

Hello,

I am not allowed in the site. It asks for admin credentials.

July 9, 2024 at 7:50 am #15918664

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Please use this login URL: hidden link

Best regards,
Osama

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