Thread Starter
liguru
(@liguru)
I use this code:
// ADDING A CUSTOM COLUMN TITLE TO ADMIN PRODUCTS LIST
add_filter( ‘manage_edit-product_columns’, ‘custom_product_column’,11);
function custom_product_column($columns)
{
//add columns
$columns[‘delivery’] = __( ‘Atributai’,’woocommerce’); // title
return $columns;
}
// ADDING THE DATA FOR EACH PRODUCTS BY COLUMN (EXAMPLE)
add_action( ‘manage_product_posts_custom_column’ , ‘custom_product_list_column_content’, 10, 2 );
function custom_product_list_column_content( $column, $product_id )
{
global $post;
// HERE get the data from your custom field (set the correct meta key below)
$atributai = get_post_meta( $product_id, ‘_product_attributes’, true );
switch ( $column )
{
case ‘delivery’ :
print_r($atributai[‘pa_sandelys’][‘value’]);
break;
}
}