WPML
Статус
Решено
Заявлено для
WPML Multilingual & Multicurrency for WooCommerce 5.1.3
Решено в
WCML 5.2.0
Связанный плагин/тема
Avada
Теги темы
Compatibility

Обзор проблемы

При использовании Avada 7.10 и выше с WPML Multilingual & Multicurrency for WooCommerce возникает следующая фатальная ошибка, если Вы пытаетесь создать страницу с помощью Live Editor от Avada.

PHP Fatal error: Uncaught Error: Call to a member function get_id() on bool in ../wp-content/plugins/woocommerce-multilingual/inc/class-wcml-orders.php:481

Обходное решение

Пожалуйста, перед продолжением обязательно сделайте полную резервную копию Вашего сайта.


  1. Откройте файл …/wp-content/plugins/woocommerce/includes/class-wc-order-item-product.php.

  2. Найдите строку 403.

  3. Замените эту строку:
    return apply_filters( 'woocommerce_get_item_downloads', $files, $this, $order );
    на:
    // WPML workaround for compsupp-6711
    if ( class_exists('Sitepress') && ! is_object($order) ) {
    	global $woocommerce_wpml;			
    
    	if ( $woocommerce_wpml && isset( $woocommerce_wpml->orders ) ) {
    		$removed = remove_filter( 'woocommerce_get_item_downloads', [ $woocommerce_wpml->orders, 'filter_downloadable_product_items' ], 10 );
    	}
    }		
    
    $result = apply_filters( 'woocommerce_get_item_downloads', $files, $this, $order );
    
    // Maybe restore the filter
    if ( $removed ) {
    	add_filter( 'woocommerce_get_item_downloads', [ $woocommerce_wpml->orders, 'filter_downloadable_product_items' ], 10, 3 );
    }
    
    return $result;

Все известные проблемы →