Home / eCommerce / Add products column to the orders list on the Vendor Dashboard
Duplicate Snippet

Embed Snippet on Your Site

Add products column to the orders list on the Vendor Dashboard

Code Preview
php
<?php
/**
 * Add the product column to the order table.
 *
 * @param array $columns The columns.
 *
 * @return array The modified columns.
 */
add_filter( 'wcv_order_table_columns', 'wcv_add_product_column_table_columns' );
/**
 * Add the product column to the order table.
 *
 * @param array $columns The columns.
 *
 * @return array The modified columns.
 */
function wcv_add_product_column_table_columns( $columns ) {
	$position    = 3;
	$first_part  = array_slice( $columns, 0, $position );
	$second_part = array_slice( $columns, $position );
	$new_column  = array(
		'products' => array(
			'label'         => __( 'Product', 'wc-vendors' ),
			'icon'          => 'wcv-icon-details',
			'mobile_header' => true,
			'full_span'     => false,
		),
	);
	return array_merge( $first_part, $new_column, $second_part );
}

Comments

Add a Comment