WPML
상태
해결됨
보고된 제품
WPML Multilingual & Multicurrency for WooCommerce 5.3.9
해결된 버전
WPML Multilingual & Multicurrency for WooCommerce 5.5.3
주제 태그
Bug, WCML

문제 개요

상품 고유주소를 상점 기준 및 카테고리로 설정한 상태에서 WPML Multilingual & Multicurrency for WooCommerce를 사용할 때 ERR_TOO_MANY_REDIRECTS 오류가 발생할 수 있습니다.

이 문제는 상품이 번역 가능 – 번역이 있으면 사용하고 없으면 기본 언어로 대체로 설정되어 있고 상품 카테고리도 번역 가능한 경우에 발생합니다. 보조 언어로 전환할 때 번역된 상품 URL이 올바르게 처리되지 않아 무한 리디렉션 루프가 발생합니다.

임시 해결 방법

계속하기 전에 사이트의 전체 백업이 준비되어 있는지 확인하세요.


  • 테마의 function.php 파일을 여세요.

  • 다음 코드를 추가하세요:
    add_filter( 'wc_product_post_type_link_product_cat', 'custom_modify_product_cat', 10, 3 );
    
    function custom_modify_product_cat( $primary_term, $terms, $post ) {
    	// Example: Replace the primary term if the product has a specific category
    	if ( $post->post_type === 'product' ) {
    		foreach ( $terms as $term ) {
    			$termid = apply_filters( 'wpml_object_id', $term->term_id, $term->taxonomy, TRUE  );
    			$term = get_term( $termid, $term->taxonomy );
    			return $term;
    		}
    	}
    	return $primary_term;
    }

알려진 모든 문제 →