Skip Navigation

Resolved

Reported for: WooCommerce Multilingual & Multicurrency 5.1.3

Resolved in: WCML 5.2.0

Topic Tags: Compatibility

Overview of the issue

When using Avada +7.10 with WooCommerce Multilingual, the following fatal error occurs if you try to create a page using Avada’s Live Editor.

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

Workaround

Please, be sure to make a full backup of your site before proceeding.

  1. Open the …/wp-content/plugins/woocommerce/includes/class-wc-order-item-product.php file.
  2. Look for line 403.
  3. Replace this line:
    return apply_filters( 'woocommerce_get_item_downloads', $files, $this, $order );
    

    With:

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