Advertisement
verygoodplugins

Untitled

Sep 21st, 2019
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. function add_order_total_field( $meta_fields ) {
  2.  
  3.     $meta_fields['order_total'] = array(
  4.         'label' => 'Last Order Total',
  5.         'group' => 'woocommerce',
  6.     );
  7.  
  8.     return $meta_fields;
  9.  
  10. }
  11.  
  12. add_filter( 'wpf_meta_fields', 'add_order_total_field' );
  13.  
  14. function get_order_total( $order_data, $order ) {
  15.  
  16.     $order_data['order_total'] = $order->get_total();
  17.  
  18.     return $order_data;
  19.  
  20. }
  21.  
  22. add_filter( 'wpf_woocommerce_customer_data', 'get_order_total', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement