Last active
October 9, 2024 00:33
-
-
Save corsonr/5975207 to your computer and use it in GitHub Desktop.
Show WooCommerce order ID in a custom column on orders list page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.