Product Icon

WooCommerce

Sell online with the flexible, customizable eCommerce platform designed to grow with your business. From your first sale to millions in revenue, Woo is with you. See why merchants trust us to power 3.4 million online stores.

Add Coupons Column in the order list

Describe the solution you’d like
I would like to be able to see the coupons used on each order in the order list view.
Like image attached

Describe alternatives you’ve considered
I have coded myself a solution:

add_filter( ‘manage_edit-shop_order_columns’, ‘create_coupon_column’ );
function create_coupon_column( $columns ) {
$new_columns = array();

foreach ( $columns as $column_key => $column_label ) {
if ( ‘order_total’ === $column_key ) {
$new_columns[‘order_coupons’] = __(‘Coupons’, ‘woocommerce’);
}

$new_columns[$column_key] = $column_label;
}
return $new_columns;
}

add_action( ‘manage_shop_order_posts_custom_column’ , ‘show_order_coupons’ );
function show_order_coupons( $column ) {
global $the_order, $post;
if( $column == ‘order_coupons’ ) {
if( $coupons = $the_order->get_coupon_codes() ) {
echo implode(‘, ‘, $coupons);
} else {
echo ‘-‘;
}
}
}

Screenshots

Author

alvaro

Current Status

Open

Last updated: April 22, 2024

0 comments

Log in to comment on this feature request.

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.