If you are having a notice about writing the .mo files please read this doc

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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.

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

Problem:
WC Follow-Ups sending emails in all the languages
Solution:
in wp-content/plugins/woocommerce-follow-up-emails/includes/fue-functions.php replace lines 558-560 with:

foreach ( $rows as $row ) {
		$args = array ('element_id'=> $row->ID, 'element_type' => $row->post_type);
		$row_language = apply_filters( 'wpml_element_language_code', null, $args );
		if ($row_language === apply_filters( 'wpml_current_language', NULL ) ) {
			$emails[] = new FUE_Email( $row->ID );
		}
	}

This topic contains 12 replies, has 2 voices.

Last updated by antoniusH 3 months, 4 weeks ago.

Assigned support staff: Bruno Kos.

Author Posts
July 6, 2019 at 5:34 pm

antoniusH

Hello!

I am using WC Follow-Ups to send emails to customers when their WC Memberships memberships become active or expire. Since it's a multilingual website, I've been using WPML to translate said emails.

I used to have many issues, but they were solved by following the instructions here: https://wpml.org/forums/topic/woocommerce-follow-ups-emails-not-translated-correctly/

However, one still remains: when sending emails in a translated language, the email gets sent in the original language as well. The original language is English.

For example: there is a membership for users that just register and it lasts 2 weeks. There are 2 emails they get before the membership expires, 3 days before and 1 day before. If they sign up on the English site, everything is fine. If they sign up on the German site however, they will get both the German emails and the English ones. Same for the Italian, Spanish, or Polish websites.

The solution here does not work: https://wpml.org/forums/topic/woocommerce-follow-up-plugin-with-wpml-4-0-7-emails-are-not-sent-correctly/

July 8, 2019 at 9:24 am #4160527

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

Thank you for contacting WPML support!

It is possible that something has changed in the meanwhile since that solution was posted or we have a regression of the issue - you are referring to this one, correct?
https://wpml.org/forums/topic/woocommerce-follow-up-plugin-with-wpml-4-0-7-emails-are-not-sent-correctly/#post-2791570

Would you be willing to set up the same scenario on our clean sandbox installation, so that we could check and test ourselves and possibly provide a new solution or workaround? Let me know and I will set it up for you.

Regards,
Bruno Kos

July 8, 2019 at 9:44 am #4160587

antoniusH

Hi Bruno,

Yes, I would be willing to set up the scenario in your sandbox installation.

Best,
Tony Hegyes

July 8, 2019 at 11:37 am #4162017

Bruno Kos
Supporter

Languages: English (English )

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

Hi Tony,

Here it is:

One Click Login:hidden link
Username:demo
Password:Jqpl6P52AX8q

Feel free to do whatever is needed inside and don't spend too much time and it - just enough as needed to reproduce this.

Also, as for checking emails, I usually use this plugins: https://wordpress.org/plugins/email-log/, as it allows us to quickly monitor all the emails that has been send through WordPress.

If manage to prove that the issue is there, please let me know what are the exact steps for us to reproduce (and expected results) so that I could send this to our compatibility team.

Regards,
Bruno Kos

July 11, 2019 at 2:16 pm #4190783

antoniusH

Hi Bruno,

I finished setting up the SandBox. I added the custom PHP code in Snippets (left-side menu in the dashboard).

To replicate the bug: go to hidden link and register an account with any email. If you look in the Dashboard -> Follow-Up -> Scheduled Emails, you'll see 2 enqueued emails for that user (named '1 day before expiring' and named '3 days before expiring'). However, if you try the same on the German or Spanish page (language switcher is in the footer), it will enqueue the emails in both the English and German variant, or English and Spanish respectively.

Best,
Tony

July 11, 2019 at 2:59 pm #4191211

Bruno Kos
Supporter

Languages: English (English )

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

Hi Tony,

Thank you very much for setting it all up! I have tested various scenarios, with or without snippets and from different languages and I can see the issue ( attached). I've sent all the information we gathered here to our compatibility team. I will update this thread as soon as I get some information from them!

Regards,
Bruno Kos

July 12, 2019 at 5:22 am #4195239

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

Can you tell me if you tried the following workaround, but not through snippets (we can disable that for now), but directly into functions.php?
https://wpml.org/it/forums/topic/follow-ups-plugin-e-wpml/#post-3235071

You can find SFTP credentials here:
hidden link

Regards,
Bruno Kos

July 12, 2019 at 12:23 pm #4198573

antoniusH

Hi Bruno,

In the original installation, the code is NOT in snippets, but in an actual PHP file. I deactivated the snippet and added the code inside the functions.php in the sandbox, and the issue persists (check the emails enqueued for the user functions@functions.php).

Best,
Tony

July 15, 2019 at 8:12 am #4208147

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

I am still consulting our compatibility team - I've tried this:
https://wpml.org/it/forums/topic/follow-ups-plugin-e-wpml/page/3/#post-3397215

And also changing the plugin code within class-fue-sending-scheduler.php, based on the link you provided in your first reply. There is some improvement from what I see - when I created in Spanish, it only returned emails in Spanish and English, but not in German anymore.

I will keep you posted!

Regards,
Bruno Kos

July 15, 2019 at 9:03 am #4208699

antoniusH

Thanks for the update! 🙂

July 15, 2019 at 11:03 am #4210115

Bruno Kos
Supporter

Languages: English (English )

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

(changing Ticket status for internal purposes - please ignore)

July 16, 2019 at 2:14 pm #4220929

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

Can you try the following? (You can also test in our sandbox).

in wp-content/plugins/woocommerce-follow-up-emails/includes/fue-functions.php replace lines 558-560 with:

foreach ( $rows as $row ) {
		$args = array ('element_id'=> $row->ID, 'element_type' => $row->post_type);
		$row_language = apply_filters( 'wpml_element_language_code', null, $args );
		if ($row_language === apply_filters( 'wpml_current_language', NULL ) ) {
			$emails[] = new FUE_Email( $row->ID );
		}
	}

This seems to be a workaround for emails, however WPML compatibility team will most likely needs to cooperate with the plugin author to get this resolved.

Can you test and let me know if this works properly?

Regards,
Bruno Kos

July 22, 2019 at 3:22 pm #4259429

antoniusH

Hi Bruno,

Sorry for the late reply! I can confirm that the code worked (both in the sandbox and in production) -- only the translated emails get sent now!