Advertisement
palsushobhan

Order list total tax

Mar 24th, 2025
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.04 KB | None | 0 0
  1. add_filter( 'wcfm_orders_additional_info_column_label', function( $column_label ) {
  2.     if (current_user_can('administrator')) {
  3.         return 'Tax';
  4.     }
  5.     return $column_label;
  6. });
  7. add_filter( 'wcfm_orders_additonal_data_hidden', function ($is_allowed) {
  8.     if (current_user_can('administrator')) {
  9.         return false;
  10.     }
  11.     return true;
  12. });
  13. add_filter( 'wcfm_orders_additonal_data', function( $column_data, $order_id ) {
  14.     if (current_user_can('administrator')) {
  15.         $order = wc_get_order( $order_id );
  16.         if ( $order->get_total_refunded() > 0 ) {
  17.             $column_data_html = '<del>' . strip_tags( wc_price( $order->get_total_tax(), array( 'currency' => $order->get_currency() ) ) ) . '</del> <ins>' . wc_price( $order->get_total_tax() - $order->get_total_tax_refunded(), array( 'currency' => $order->get_currency() ) ) . '</ins>';
  18.         } else {
  19.             $column_data_html = wc_price( $order->get_total_tax(), array( 'currency' => $order->get_currency() ) );
  20.         }
  21.     }
  22.     return $column_data_html;
  23. }, 50, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement