WooCommerce 如何自定义显示的订单字段的默认内容?

我能够添加新的管理订单列表列,但不知道如何更改或格式化订单列的内容显示。


add_filter( 'manage_edit-shop_order_columns', 'MY_COLUMNS_FUNCTION' );

function MY_COLUMNS_FUNCTION( $columns ) {

    $new_columns = ( is_array( $columns ) ) ? $columns : array();

    $new_columns['MY_COLUMN_ID_1'] = 'Payment';

    return $new_columns;

}

add_action( 'manage_shop_order_posts_custom_column', 'MY_COLUMNS_VALUES_FUNCTION', 10,2 );

function MY_COLUMNS_VALUES_FUNCTION( $column ) {

global $post;

if ( $column === 'order_number' ) { echo $post->ID;}}

http://img2.mukewang.com/62da59940001c85f11980295.jpg

慕沐林林
浏览 104回答 1
1回答

慕桂英4014372

add_filter('manage_edit-shop_order_columns', 'webtoffee_alter_order_columns');function webtoffee_alter_order_columns($columns) {    $new_columns = ( is_array($columns) ) ? $columns : array();    unset($new_columns['order_number']);    $res_array = array_slice($new_columns, 0, 1, true) + array("custom_order_number" => "Order Number") +  array_slice($new_columns, 1, count($new_columns)-1, true);    return $res_array;}add_action('manage_shop_order_posts_custom_column', 'webtoffee_alter_order_number_columns', 10, 2);function webtoffee_alter_order_number_columns($column) {    global $post, $woocommerce, $the_order;    if ($column === 'custom_order_number') {        // do your stuff    }}
打开App,查看更多内容
随时随地看视频慕课网APP