2017-09-28 1 views
1

woocommerce 대시 보드의 대량 주문 세부 사항에 mycustomfield21 (체크 아웃 관리자로 계산대에 추가됨)을 추가하려고합니다.Woocommerce 관리 주문 목록에 사용자 정의 필드 추가 "주문"기존 열

enter image description here

EDITED 질문을

이미 2 개 필드, 느릅 나무 instert 이름 (myfield21)과 성 (myfield22)이 있으며, 내가 할 수있는 방법 표시 : 여기에 내가 필요한 보여주는 스크린 샷입니다 그들 사이에 공백이 있습니까? "첫 번째 성"과 같이 표시되기 때문에

답변

1

manage_shop_order_posts_custom_column 액션 후크에 사용자 지정 함수를 후킹 할 수 있습니다. 나는 기존의 주문에 청구 전화를 추가하고 아래 ("Pedido") 열 데이터 :

add_action('manage_shop_order_posts_custom_column' , 'custom_orders_list_column_content', 10, 2); 
function custom_orders_list_column_content($column, $post_id) { 
    if ($column == 'order_title') 
    { 
     // The billing phone for example (to be repaced by your custom field meta_key) 
     $custom_field_value = get_post_meta($post_id, '_billing_phone', true); 
     if(! empty($custom_field_value)) 
      echo $custom_field_value; 
    } 
} 

코드 활성 자식 테마 (또는 테마)의 function.php 파일에 간다 나 또한 어떤 플러그인 파일입니다.

테스트를 거쳐 작동합니다.

+0

효과가있었습니다. 대단히 감사합니다! –

관련 문제