- Trạng thái
- Đã được giải quyết bởi nhà phát triển
- Đã giải quyết trong
- Woocommerce Subscriptions 8.2.0
- Plugin/giao diện liên quan
- WooCommerce Subscriptions
- Thẻ chủ đề
- Compatibility
Tổng quan về lỗi
Khi xem các đơn hàng liên quan đến WooCommerce Subscriptions trong khi WPML đang hoạt động, người dùng có thể gặp phải lỗi PHP nghiêm trọng:
PHP Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in .../wp-content/plugins/sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-element-translation.php:259
Giải pháp tạm thời
Vui lòng đảm bảo có một bản sao lưu đầy đủ trang web của bạn trước khi tiếp tục.
- Mở tệp …/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/wcs-helper-functions.php.
- Thay đổi từ:
function wcs_get_edit_post_link( $post_id ) { $object = wc_get_order( $post_id ); // works for both WC Order and WC Subscription objects. if ( ! $object || ! in_array( $object->get_type(), array( 'shop_order', 'shop_subscription' ), true ) ) { return; } return apply_filters( 'get_edit_post_link', $object->get_edit_order_url(), $post_id, '' ); } - Thành:
function wcs_get_edit_post_link( $post_id ) { if ($post_id instanceof('WC_Subscription')){ $post_id = $post_id->id; } $object = wc_get_order( $post_id ); // works for both WC Order and WC Subscription objects. if ( ! $object || ! in_array( $object->get_type(), array( 'shop_order', 'shop_subscription' ), true ) ) { return; } return apply_filters( 'get_edit_post_link', $object->get_edit_order_url(), $post_id, '' ); }