Advertisement
palsushobhan

wcfm-delivery-time-on-vendor-admin-email

Jan 22nd, 2024 (edited)
667
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.19 KB | None | 0 0
  1. add_action( 'woocommerce_email_order_meta', function( $order, $is_plain = 0, $is_admin = 0, $email = null, $preferred_vendor = 0 ) {
  2.     global $WCFMd;
  3.     if( ! apply_filters('wcfm_is_pref_delivery_time', true) || ! apply_filters( 'wcfm_is_allow_delivery_time', true ) ) return;
  4.     if ( function_exists( 'is_wcfm_page' ) && is_wcfm_page() ) return;
  5.     if ( !$email || !in_array($email->id, ['store-new-order', 'new_order'])) return;
  6.     $wcfmd_delvery_times = $order->get_meta( '_wcfmd_delvery_times', true );
  7.     if( empty(  $wcfmd_delvery_times ) ) return;
  8.            
  9.     echo "<br />";
  10.     echo "<h2 style='font-size: 18px; color: #17a2b8; line-height: 20px;margin-top: 6px;margin-bottom: 10px;padding: 0px;text-decoration: underline;'>" . __( 'Delivery Time(s)', 'wc-frontend-manager-delivery' ) . "</h2>";
  11.     echo "<table width='100%' style='width:100%;'><tbody>";
  12.     foreach ( $wcfmd_delvery_times as $vendor_id => $wcfmd_delvery_time ) {
  13.         if( $preferred_vendor && ( $preferred_vendor != $vendor_id) ) continue;
  14.         $store_name          = wcfm_get_vendor_store_name( $vendor_id );
  15.         $time_format = $WCFMd->wcfmd_delivery_time->get_time_format($vendor_id);
  16.         ?>
  17.         <tr>
  18.             <td colspan="3" style="background-color: #eeeeee;padding: 1em 1.41575em;line-height: 1.5;font-weight:600;">
  19.                 <?php
  20.                 echo $store_name;
  21.                 ?>
  22.             </td>
  23.             <td colspan="5" style="background-color: #f8f8f8;padding: 1em;"><?php echo  $WCFMd->wcfmd_delivery_time->format_delivery_time_checkout_field($time_format, $wcfmd_delvery_time ); ?></td>
  24.         </tr>
  25.         <?php
  26.     }
  27.     echo "</tbody></table>";
  28.     echo "<br />";
  29.     if($order->get_customer_note()) {
  30.         echo "<h2 style='font-size: 18px; color: #17a2b8; line-height: 20px;margin-top: 6px;margin-bottom: 10px;padding: 0px;text-decoration: underline;'>" . __( 'Note', 'wc-frontend-manager-delivery' ) . "</h2>";
  31.         echo "<table width='100%' style='width:100%;'><tbody>";
  32.         echo "<tr><td>". wp_kses_post( nl2br( wptexturize( $order->get_customer_note() ) ) ) . "</td></tr>";
  33.         echo "</tbody><table>";
  34.         echo "<br />";
  35.     }
  36. }, 10, 5 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement