dongxia8656
2019-05-12 14:41
浏览 120
已采纳

将产品缩略图添加到Woocommerce管理订单列表

I would like to add futured image on admin view order pages in Woocommerce. New Column created, but the product image does not appear. What should I do to show the order thumbnail? Thanks.

// Admin Order page new colums
add_filter( 'manage_edit-shop_order_columns', 'add_account_orders_column', 10, 1 );
function add_account_orders_column( $columns ){
    $columns['custom-column'] = __( 'New Column', 'woocommerce' );

    return $columns;
}

add_action( 'woocommerce_my_account_my_orders_column_custom-column', 'add_account_orders_column_rows' );
function add_account_orders_column_rows( $order ) {
    // Example with a custom field
    if ( $value = $order->get_meta( 'order_received_item_thumbnail_image' ) ) {
        echo esc_html( $value );
    }
}

图片转代码服务由CSDN问答提供 功能建议

我想在Woocommerce的管理视图订单页面上添加未来图像。 新列已创建,但产品图像未显示。 如何显示订单缩略图? 谢谢。

  //管理员订单页面新建colums 
add_filter  ('manage_edit-shop_order_columns','add_account_orders_column',10,1); 
 
功能add_account_orders_column($ columns){
 $ columns ['custom-column'] = __('新专栏','woocommerce'); 
  
返回$ columns; 
} 
 
add_action('woocommerce_my_account_my_orders_column_custom-column','add_account_orders_column_rows'); 
 
函数add_account_orders_column_rows($ order){
 //自定义字段示例
 if($ value = $  order-> get_meta('order_received_item_thumbnail_image')){
 echo esc_html($ value); 
} 
} 
   
 
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题