Skip to content

Instantly share code, notes, and snippets.

@corsonr
Last active October 9, 2024 00:33
Show Gist options
  • Save corsonr/5975207 to your computer and use it in GitHub Desktop.
Save corsonr/5975207 to your computer and use it in GitHub Desktop.
Show WooCommerce order ID in a custom column on orders list page
<?php
/**
* Plugin Name: WooCommerce - Show order IDs
* Plugin URI: http://www.remicorson.com/easily-find-woocommerce-order-id/
* Description: Adds a new columns to order list page to display order IDs
* Version: 1.0
* Author: Remi Corson
* Author URI: http://remicorson.com
* Requires at least: 3.5
* Tested up to: 3.5
*
* Text Domain: -
* Domain Path: -
*
*/
/*
|--------------------------------------------------------------------------
| WooCommerce Order Extra Columns
|--------------------------------------------------------------------------
*/
/**
* Load Custom Order Columns
*
* @access public
* @since 1.0
* @return
*/
function woo_order_extra_columns($columns)
{
$newcolumns = array(
"cb" => "<input type = \"checkbox\" />",
"order_ID" => esc_html__('ID', 'woocommerce'),
);
$columns = array_merge($newcolumns, $columns);
return $columns;
}
add_filter("manage_edit-shop_order_columns", "woo_order_extra_columns");
/**
* Charge Order Columns Content
*
* @access public
* @since 1.0
* @return
*/
function woo_order_extra_columns_content($column)
{
global $post;
$order_id = $post->ID;
switch ($column)
{
case "order_ID":
echo $order_id;
break;
}
}
add_action("manage_posts_custom_column", "woo_order_extra_columns_content");
@sailesh0007
Copy link

sailesh0007 commented Dec 19, 2016

Hi corsonr,
I want to display customer id instead of order id in a custom column on orders list page and customer id should be editable.
Please help me out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment