You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At first let me say I know that you guys are not officially supporting Polylang -- I'm just investigating an issue with it and am a bit lost which plugin is responsible.
Situation:
woocommerce 8.0.1
polylang-wc 1.9.2
polylang-pro 3.5.3
mollie-payments-for-woocommerce 7.4.0
When a payment is redirected back via the webhookUrl, the order is updated to processing, of course. On that moment, the 'polylang-wc' plugin adds a filter that sets the language:
/**
* Setups actions related to emails sent to a customer.
*
* @since 1.7
*
* @return void
*/
protected function customer_emails_init() {
/**
* Filters the actions used to send translated customer emails related to an order.
* The actions in the list must pass a `WC_Order` or order id as first parameter.
*
* @since 1.6
*
* @param string[] $email_actions Array of actions used to send order emails.
*/
$actions = apply_filters(
'pllwc_order_email_actions',
array(
// Completed order.
'woocommerce_order_status_completed_notification',
// Customer note.
'woocommerce_new_customer_note_notification',
// On hold.
'woocommerce_order_status_failed_to_on-hold_notification',
'woocommerce_order_status_pending_to_on-hold_notification',
'woocommerce_order_status_cancelled_to_on-hold_notification',
// Processing.
'woocommerce_order_status_cancelled_to_processing_notification',
'woocommerce_order_status_failed_to_processing_notification',
'woocommerce_order_status_on-hold_to_processing_notification',
'woocommerce_order_status_pending_to_processing_notification',
// Refunded order.
'woocommerce_order_fully_refunded_notification',
'woocommerce_order_partially_refunded_notification',
)
);
foreach ( $actions as $action ) {
add_action( $action, array( $this, 'before_order_email' ), 1 ); // Switch the language for the email.
add_action( $action, array( $this, 'after_email' ), 999 ); // Switch the language back after the email has been sent.
}
}
/**
* Sets the email language depending on the order language.
* Hooked to order notifications.
*
* @since 0.1
*
* @param int|array|WC_Order $order Order or order ID.
* @return void
*/
public function before_order_email( $order ) {
if ( is_numeric( $order ) ) {
$order_id = $order;
} elseif ( is_array( $order ) ) {
$order_id = $order['order_id'];
} elseif ( is_object( $order ) ) {
$order_id = $order->get_id();
}
if ( ! empty( $order_id ) ) {
$lang = $this->data_store->get_language( $order_id );
$language = PLL()->model->get_language( $lang );
if ( $language ) {
$this->set_email_language( $language );
}
}
}
/**
* Restores the current language after the email has been sent.
* Hooked to order and user notifications.
*
* @since 0.1
*
* @return void
*/
public function after_email() {
if ( empty( $this->previous_languages ) ) {
return;
}
$previous = array_pop( $this->previous_languages );
if ( $previous['switched'] ) {
restore_previous_locale();
}
PLL()->curlang = $previous['language'];
}
This does work, I can confirm from making a status change on an order in the back-end. With other payment methods it works too.
However, when using Mollie it does not.
So I am investigating:
Is the Mollie plugin actually firing woocommerce_order_status_pending_to_processing_notification, or does it not use that at all?
Could the prioritization of the filters be in the wrong order of some sorts?
Would there be a workaround?
The clients customers are receiving default mails now, while they should get them in the site's language.
Hope you guys can help.
The text was updated successfully, but these errors were encountered:
At first let me say I know that you guys are not officially supporting Polylang -- I'm just investigating an issue with it and am a bit lost which plugin is responsible.
Situation:
When a payment is redirected back via the webhookUrl, the order is updated to processing, of course. On that moment, the 'polylang-wc' plugin adds a filter that sets the language:
This does work, I can confirm from making a status change on an order in the back-end. With other payment methods it works too.
However, when using Mollie it does not.
So I am investigating:
woocommerce_order_status_pending_to_processing_notification
, or does it not use that at all?The clients customers are receiving default mails now, while they should get them in the site's language.
Hope you guys can help.
The text was updated successfully, but these errors were encountered: