Home / Admin / Add a custom column to Commission table
Duplicate Snippet

Embed Snippet on Your Site

Add a custom column to Commission table

Code Preview
php
<?php
/**
 * Add custom columns label
 *
 * @param  Array $columns array stored column names 
 * @return Array $columns
 */
function custom_commissions_columns( $columns ) {
	$columns['id'] = __( 'ID', 'wc-vendors' );
	return $columns;
}
add_filter( 'wcvendors_commissions_columns', 'custom_commissions_columns', 10, 1 );
/**
 * Add custom columns value
 *
 * @param  mixed  $value current value in loop
 * @param  Object $item current item in loop
 * @param  mixed  $column_name name of column in query result
 * @return mixed .
 */
function add_custom_commission_column( $value, $item, $column_name ) {
	switch ( $column_name ) {
		case 'id':
			return $item->id;
		break;
	}
}
add_filter( 'wcvendors_commissions_column_default_id', 'add_custom_commission_column', 10, 3 );

Comments

Add a Comment