How can we improve WooCommerce?

Compatibility with WPML

From the WPML support forum.

If I set follow-ups as translatable the customer receives 2 emails, one in each language. And both have product names in the default language.

Suggested solution

1) Have follow-ups translatable by default including the attached wpml-config.xml file in the root folder of the plugin.

2) With these few lines we can resolve the 2 issues described.
The first function makes sure we only get follow-ups in the current language.
The second function switches language temporarily to the language the order was made in so that product names are translated too.

add_filter( 'fue_get_emails_args', function( $args ) {
$args['suppress_filters'] = false;
return $args;
} );

add_filter( 'fue_queue_item_filter_conditions_before_sending', function( $send, $queue_item ) {
global $sitepress;

$language = get_post_meta( $queue_item->order_id, 'wpml_language', true );
$sitepress->switch_lang( $language );
$sitepress->set_admin_language( $language );

return $send;
}, 10, 2 );

Let me know if you prefer a PR instead.

0 votes
Sign in
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
AdminWooCommerce (Product Owner, WooCommerce) shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Sign in with: facebook google
Signed in as (Sign out)

WooCommerce: Extension - WooCommerce Follow-up Emails

Feedback and Knowledge Base