Skip to content

Instantly share code, notes, and snippets.

@trueqap
Last active January 28, 2018 06:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trueqap/55c709a313c8ff8008433e06f28f7d62 to your computer and use it in GitHub Desktop.
Save trueqap/55c709a313c8ff8008433e06f28f7d62 to your computer and use it in GitHub Desktop.
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