Advertisement
chris_di

Woocommerce - custom field in Order overview

Feb 17th, 2021
993
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1. function sv_wc_add_my_account_orders_column( $columns ) {
  2.  
  3.     $new_columns = array();
  4.  
  5.     foreach ( $columns as $key => $name ) {
  6.  
  7.         $new_columns[ $key ] = $name;
  8.  
  9.         // add ship-to after order status column
  10.         if ( 'order-number' === $key ) {  //this is the line!
  11.             $new_columns['custom-column'] = __( 'Titel', 'woocommerce' );
  12.         }
  13.     }
  14.  
  15.     return $new_columns;
  16. }
  17. add_filter( 'woocommerce_my_account_my_orders_columns', 'sv_wc_add_my_account_orders_column' );
  18.  
  19.  
  20.     function wc_custom_column_display( $order ) {
  21.         // do something here?>
  22.          <p>Titel: <?php the_field('titel_bestellung-info', $order->get_id()); ?></p><?php
  23.     }
  24.     add_action( 'woocommerce_my_account_my_orders_column_custom-column', 'wc_custom_column_display' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement