WPML
ステータス
解決済み
報告対象
WPML Multilingual & Multicurrency for WooCommerce 4.8.0
解決されたバージョン
WooCommerce Multilingual 4.9.0-b1

問題の概要

YITH Affiliate、YITH Giftcards、WCFMプラグイン、およびその他のいくつかのプラグインからメールを送信する際、次のようなエラーが発生する場合があります:

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

回避策

開発チームはこの問題の修正に取り組んでいます。
一時的な回避策として、サイトの完全なバックアップを取得したことを確認した上で、wp-content/plugins/woocommerce-multilingual/inc/class-wcml-emails.phpを開き、コードを以下から:

	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 );

次のコードに変更します:

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 );
}

すべての既知の問題 →