Home Forums WoodMart support forum Unable to customize the woocommerce order area on backend Reply To: Unable to customize the woocommerce order area on backend

#551915

refa
Participant

I tried that plugin but it didn’t work for me.

The customization I tried on the Woocommerce -> Orders page is not working even if it is a plugin or custom code it doesn’t matter, I don’t know why. I also tried with the below code to add a Time column on the Woocommerce -> Order page that also didn’t work.

/* Add time column to the woocommerce orders area */

function custom_shop_order_column_headers($columns)
{
$new_columns = array();

foreach ($columns as $key => $column) {
$new_columns[$key] = $column;
if ($key === ‘order_date’) {
$new_columns[‘order_time’] = __(‘Time’, ‘woocommerce’);
}
}

return $new_columns;
}
add_filter(‘manage_edit-shop_order_columns’, ‘custom_shop_order_column_headers’);

// Display Date and Time in custom column
function custom_shop_order_column_content($column)
{
global $post, $the_order;

if ($column === ‘order_time’) {
if (empty($the_order)) {
$the_order = wc_get_order($post->ID);
}

if ($the_order) {
echo ‘<time datetime=”‘ . esc_attr($the_order->get_date_created()->date(‘c’)) . ‘”>’ . esc_html($the_order->get_date_created()->date(‘H:i’)) . ‘</time>’;
}
}
}
add_action(‘manage_shop_order_posts_custom_column’, ‘custom_shop_order_column_content’);

Attachments:
You must be logged in to view attached files.