- 상태
- 개발자가 해결함
- 해결된 버전
- Woocommerce Subscriptions 8.2.0
- 관련 플러그인/테마
- WooCommerce Subscriptions
- 주제 태그
- Compatibility
문제 개요
WPML이 활성화된 상태에서 WooCommerce Subscriptions와 관련된 주문을 조회할 때 치명적인 PHP 오류가 발생할 수 있습니다:
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
임시 해결 방법
진행하기 전에 사이트의 전체 백업을 반드시 수행하세요.
- …/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/wcs-helper-functions.php 파일을 여세요.
- 변경 전:
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, '' ); } - 변경 후:
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, '' ); }