All Topics
Product Sold / Sales Column
Hi,
i’m trying to add woocoomerce column in product list to show number of sales (number of item purchased) and orders.
but i receive strange data.
1. in some product i have Orders > Sales
example orders 60 – sales 23
if at least one quantity is purchased for each order, I shouldn’t have a number greater than or equal to in sales of >=60 ?
2. with my previous code on file function:
add_action( 'manage_product_posts_custom_column', 'wpcb_render_product_column_total_sales', PHP_INT_MAX );
function wpcb_render_product_column_total_sales( $column ) {
if ( 'total_sales' === $column ) {
$total_sales = get_post_meta( get_the_ID(), 'total_sales', true );
echo $total_sales;
}
}
/**
* This is only needed if you want to make the column sortable.
*/
add_filter( 'manage_edit-product_sortable_columns', 'wpcb_sortable_column_total_sales', PHP_INT_MAX );
function wpcb_sortable_column_total_sales( $columns ) {
$columns['total_sales'] = 'total_sales';
return $columns;
}
i see that results are not the same.
i have more product sold result with code snippet.
3. is there a way to filter and order these columns, i need to create also a Top Seller Product View sortable.
Thanks
You must be logged in to reply to this topic.