Resolved
Reported for: WooCommerce Multilingual & Multicurrency 5.1.3
Resolved in: WCML 5.2.0
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.
- Open the …/wp-content/plugins/woocommerce/includes/class-wc-order-item-product.php file.
- Look for line 403.
- Replace this line:
1
return
apply_filters(
'woocommerce_get_item_downloads'
,
$files
,
$this
,
$order
);
With:
1234567891011121314151617// 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
;