Advertisement
borkolivic

Ukloni red Ukupno i prikaži prilagođeni red u mailovima

Jan 10th, 2022
875
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1. // ovo će utjecati na mailove, Order received (Thank you page) i My account - View order
  2.  
  3. // Prvo ćemo "otkačiti" red UKUPNO
  4. function remove_total_from_order_totals_lines( $totals ) {
  5.     unset($totals['order_total']  );
  6.     return $totals;
  7. }
  8. add_filter( 'woocommerce_get_order_item_totals', 'remove_total_from_order_totals_lines', 100, 1 );
  9.  
  10. //... zatim ćemo dodati novi red sa custom tekstom i formatiranom cijenom po želji
  11. function mx_woocommerce_get_order_item_totals( $total_rows, $order, $tax_display ) {
  12.     // Get total for the new row
  13.     $ukupno_za_platiti = $order->get_total();
  14.    
  15.     // Add custom row
  16.     $total_rows['ukupno_za_platiti']['label'] = __( 'Ukupno za platiti:', 'woocommerce' );
  17.     $total_rows['ukupno_za_platiti']['value'] = wc_price( $ukupno_za_platiti ).(' (uklj. PDV)');
  18.  
  19.     return $total_rows;
  20. }
  21. add_filter( 'woocommerce_get_order_item_totals', 'mx_woocommerce_get_order_item_totals', 10, 3 );
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement