Set customer locale on emails
-
Hello,
Thank you for the plugin.
I have one suggestion that will improve customer experience for stores where managers/admins and customers may not have the same language settings.
Email trigger function should have calls to locale helper funcions (setup_locale and restore_locale) in case it needs to be set to customer one rather than admin one. Please find a sample below:
public function trigger( $args ) { $this->setup_locale(); if ( ! empty( $args ) ) { $defaults = array( 'order_id' => '', 'customer_note' => '', ); $args = wp_parse_args( $args, $defaults ); $order_id = $args['order_id']; $customer_note = $args['customer_note']; if ( $order_id ) { $this->object = wc_get_order( $order_id ); if ( $this->object ) { $this->recipient = $this->object->get_billing_email(); $this->customer_note = $customer_note; $this->placeholders['{order_date}'] = wc_format_datetime( $this->object->get_date_created() ); $this->placeholders['{order_number}'] = $this->object->get_order_number(); } } } if ( $this->is_enabled() && $this->get_recipient() ) { $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() ); } $this->restore_locale(); }
Thank you.
Regards.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Set customer locale on emails’ is closed to new replies.