- Status
- Resolved
- Reported for
- WPML Multilingual & Multicurrency for WooCommerce 4.8.0
- Resolved in
- WooCommerce Multilingual 4.9.0-b1
Overview of the issue
On sending an e-mail from YITH Affiliate, YITH Giftcards, WCFM plugins and possible some others, you can encounter an error like this one:
PHP Fatal error: Uncaught Error: Call to a member function get_id() on array in /public_html/wp-content/plugins/woocommerce-multilingual/inc/class-wcml-emails.php:395
Workaround
Our developers are working on fixing this problem.
As a temporary workaround, and only after you make sure you have a full backup of your site, you can go to wp-content/plugins/woocommerce-multilingual/inc/class-wcml-emails.php and change the code from:
public function get_email_translated_string( $key,
$object, $language)
{
$context = 'admin_texts_woocommerce_' . $object->id . '_settings';
$name = '[woocommerce_' . $object->id . '_settings]' . $key;
return $this->wcml_get_translated_email_string( $context, $name, $object->object->get_id(), $language );
to this code:
public function get_email_translated_string( $key, $object, $language ) {
$context = 'admin_texts_woocommerce_' . $object->id . '_settings';
$name = '[woocommerce_' . $object->id . '_settings]' . $key;
$order_id = false;
if ( method_exists( $object->object, 'get_id' ) ) {
$order_id = $object->object->get_id();
}
if ( is_array( $object->object ) && isset( $object->object['ID'] ) ) {
$order_id = $object->object['ID'];
}
return $this->wcml_get_translated_email_string( $context, $name, $order_id, $language );
}