WPML

문제 개요

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

임시 해결 방법

이 문제는 Woocommerce Subscriptions 8.2.0에서 해결되었습니다. 업데이트하면 사이트에서 문제가 해결되므로, 아직 업데이트할 수 없는 경우에만 이 임시 해결 방법이 필요합니다.

진행하기 전에 사이트의 전체 백업을 반드시 수행하세요.

  • …/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, '' );
    }

모든 알려진 문제

여전히 이 문제가 발생합니까?

업데이트해도 문제가 해결되지 않으면 지원 문의를 하세요. 함께 살펴보겠습니다.