Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add time and date to WooCommerce order page with new column.
<?php
//https://woopress.hu/forumok/tema/rende/
function RENDELES_DATUMA_ES_IDO_OSZLOP( $columns ) {
$new_columns = ( is_array( $columns ) ) ? $columns : array();
unset( $new_columns[ 'order_actions' ] );
$new_columns['RENDELES_DATUMA_ES_IDO'] = 'Rendelés dátuma';
$new_columns[ 'order_actions' ] = $columns[ 'order_actions' ];
return $new_columns;
}
function RENDELES_DATUMA_ES_IDO_TARTALOM( $column ) {
global $post;
$data = get_post_meta( $post->ID );
if ( $column == 'RENDELES_DATUMA_ES_IDO' ) {
$order = new WC_Order($post->ID);
$order_date = $order->order_date;
echo $order_date ;
}
}
add_filter( 'manage_edit-shop_order_columns', 'RENDELES_DATUMA_ES_IDO_OSZLOP' );
add_action( 'manage_shop_order_posts_custom_column', 'RENDELES_DATUMA_ES_IDO_TARTALOM', 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.