Reputation:
In the Woocommerce customer account, I'd like to remove the following columns:
And add a column to display attached files (thanks to the WooCommerce Attach Me! plugin). The developer gave me this information:
"To get all the order attachments use the following snippet:"
global $wcam_order_model;
$order_attachments = $wcam_order_model->get_attachments_metadata($order_id , array());
Where $order_id is the order id for which you want to retreive attachments. Then to get each attachment title use the following shippet:
foreach($order_attachments as $order_attachment)
$file_name = basename($order_attachment['absolute_path']);
I have found a tutorial here: https://www.skyverge.com/blog/adding-columns-woocommerce-orders-list/
But I can't get it work. As you imagine, I am not a developer :/
Thank you very much!
Upvotes: 0
Views: 1853
Reputation: 1
Put this in your functions.php
function sv_wc_add_my_account_orders_column( $columns ) {
$new_columns = array();
foreach ( $columns as $key => $name ) {
if( 'order-number' === $key || 'order-total' === $key ) {
echo ' name '.$name . ' key ' . $key ;
continue;
}
$new_columns[ $key ] = $name;
/*if( 'order-date' === $key) {
$new_columns['order-number'] = __( 'Order', 'textdomain' );
$new_columns['order-rental-period'] = __( 'Rental Period', 'textdomain' );
$new_columns['order-detail'] = __( 'Order or Quotation Detail', 'textdomain' );
}*/
}
add_filter( 'woocommerce_my_account_my_orders_columns', 'sv_wc_add_my_account_orders_column' );
return $new_columns;
}
Upvotes: 0