- 状态
- 已解决
- 报告针对
- WPML Multilingual & Multicurrency for WooCommerce 5.1.3
- 解决于
- WCML 5.2.0
- 相关插件/主题
- Avada
- 主题标签
- Compatibility
问题概述
在使用 Avada +7.10 与 WPML Multilingual & Multicurrency for WooCommerce 时,如果您尝试使用 Avada 的 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
临时解决方法
在继续操作之前,请务必对您的站点进行完整备份。
- 打开 …/wp-content/plugins/woocommerce/includes/class-wc-order-item-product.php 文件。
- 找到第 403 行。
- 将此行:
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;