WooCommerce> 보고서에 Customer List라는 고객 탭 아래에 열을 추가해야합니다.
주소 (billing_address_1), 건물 번호 (billing_billing_number), 도시 (billing_city), 주 (billing_state) 및 사용자 정의 필드를 Apartment Complex (apt_complex)라는 양식에 추가하고 싶습니다.
어떻게하면됩니까?WooCommerce 보고서/고객 목록에 열 추가
1
A
답변
0
아주 가깝습니다. 그러나 당신은 이렇게 할 수 있습니다. 이것은 내가 얻을 수있는 가장 가까운 곳입니다.
woocommerce_admin_reports
으로 필터를 생성하십시오. 특히 고객 목록 보고서의 콜백을 변경해야합니다. 그 밑에는 'customer_list_get_report'
입니다.
add_filter('woocommerce_admin_reports', 'woocommerce_admin_reports');
function woocommerce_admin_reports($reports) {
$reports['customers']['reports']['customer_list']['callback'] = 'customer_list_get_report';
return $reports;
}
다음에 'customer_list_get_report'
함수를 만듭니다. 이 함수는 보고서를 생성합니다. do_action
을 메모 해 두십시오. 여기에 클래스 WC_Report_Customer_List
이 포함되어있어 확장하고 일부 기능을 덮어 쓸 수 있습니다.
function customer_list_get_report($name) {
$class = 'My_WC_Report_Customer_List';
do_action('class_wc_report_customer_list');
if (! class_exists($class))
return;
$report = new $class();
$report->output_report();
}
아래의 내용은 수정 한 내용입니다.
add_action('class_wc_report_customer_list', 'class_wc_report_customer_list');
function class_wc_report_customer_list() {
if (! class_exists('WC_Report_Customer_List')) {
include_once(WC_ABSPATH . 'includes/admin/reports/class-wc-report-customer-list.php');
}
class My_WC_Report_Customer_List extends WC_Report_Customer_List {
/**
* Get column value.
*
* @param WP_User $user
* @param string $column_name
* @return string
*/
public function column_default($user, $column_name) {
global $wpdb;
switch ($column_name) {
case 'city' :
return get_user_meta($user->ID, 'billing_city', true);
}
return parent::column_default($user, $column_name);
}
/**
* Get columns.
*
* @return array
*/
public function get_columns() {
/* default columns.
$columns = array(
'customer_name' => __('Name (Last, First)', 'woocommerce'),
'username' => __('Username', 'woocommerce'),
'email' => __('Email', 'woocommerce'),
'location' => __('Location', 'woocommerce'),
'orders' => __('Orders', 'woocommerce'),
'spent' => __('Money spent', 'woocommerce'),
'last_order' => __('Last order', 'woocommerce'),
'user_actions' => __('Actions', 'woocommerce'),
); */
// sample adding City next to Location.
$columns = array(
'customer_name' => __('Name (Last, First)', 'woocommerce'),
'username' => __('Username', 'woocommerce'),
'email' => __('Email', 'woocommerce'),
'location' => __('Location', 'woocommerce'),
'city' => __('City', 'woocommerce'),
);
return array_merge($columns, parent::get_columns());
}
}
}
예를 들어 City를 추가했습니다. 필요한 다른 사람들도 할 수 있습니다. 그것은 다음과 같이 보일 것입니다 : 당신이 볼 수 있듯이
,시의 열이 추가되었습니다.
관련 문제
- 1. 열 목록에 동적으로 열 추가
- 2. 목록에 추가 매핑 열
- 3. 목록에 CSV 파일 열 추가
- 4. RailsAdmin의 목록에 추가 열 값 추가
- 5. WooCommerce - 제품 카탈로그 관리 테이블에 열 추가
- 6. CSOM을 사용하여 목록에 조회 열 추가
- 7. 각 데이터 프레임 목록에 열 추가
- 8. 목록 행렬 목록에 일부 열 추가
- 9. 관찰 가능 목록에 계산 열 추가
- 10. Woocommerce 관리 주문 목록에 사용자 정의 필드 추가 "주문"기존 열
- 11. 변경 WooCommerce 제품 열
- 12. 목록에 기능 목록에 추가
- 13. woocommerce 카테고리에서 하위 카테고리 추가
- 14. Woocommerce - 여러 매장 추가
- 15. woocommerce 합계에 가격 추가
- 16. Woocommerce 추가 정보가 있습니다.
- 17. WooCommerce Checkout에 단계 추가
- 18. 장바구니에 제품 추가 WooCommerce?
- 19. 맞춤 이메일 추가 Woocommerce
- 20. 목록에 추가
- 21. Spark Dataframe의 열 목록에 행 열 추가하기
- 22. 목록에 SQL Netezza 열
- 23. 목록에 열 만들기
- 24. woocommerce 제품에 "추가 정보"버튼 추가
- 25. WooCommerce 추가 탭 추가 - 단일 제품 페이지
- 26. 반복 목록 추가 목록에 추가
- 27. DropDown 목록에 추가 레이블 추가
- 28. wpf 표 열 추가 요약 열
- 29. woocommerce wordpress에 지불 방법 추가
- 30. Woocommerce : 머리글에 카트 무게 추가