Advertisement
danine1

order totals

Oct 9th, 2019
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.35 KB | None | 0 0
  1. <?php
  2. /*
  3.  * Add total order price and total number of ordered products to header of email
  4.  */
  5. $totals = $order->get_order_item_totals();
  6. $totalProducts = $order->get_item_count();
  7. ?>
  8.  
  9. <?php
  10.     if ($totals) {
  11.       $i = 0;
  12.  
  13.       foreach ($totals as $total) {
  14.         $i++;
  15.  
  16.         if (($total['label'] !== 'Zwischensumme:') && ($total['label'] !== 'Zahlungsmethode:')) :
  17.      ?>
  18.       <tr>
  19.         <th scope="row" colspan="2" style="text-align:left; border: 1px solid #eee; font-family: 'Barlow Condensed', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;
  20. ">Gesamtzahl der bestellten Produkte:</th>
  21.         <td style="text-align:left; border: 1px solid #eee;font-family: 'Barlow Condensed', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; font-weight:bold;
  22. "><?php echo $totalProducts; ?></td>
  23.       </tr>
  24.  
  25.       <tr>
  26.           <th></th>
  27.           <td></td>
  28.       </tr>
  29.  
  30.            <tr>
  31.                <th scope="row" colspan="2" style="text-align:left; border: 1px solid #eee; <?php if ($i == 1) {
  32.            echo 'border-top-width: 4px;';
  33.          } ?>"><?php echo $total['label']; ?></th>
  34.                  <td style="text-align:left; border: 1px solid #eee; <?php if ($i == 1) {
  35.            echo 'border-top-width: 4px;';
  36.          } ?>"><?php echo $total['value']; ?>
  37.                </td>
  38.                 </tr>
  39.       <?php
  40.           endif;
  41.         }
  42.       }
  43.       ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement