Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Order details table shown in emails.
*
* This template can be overridden by copying it to yourtheme/woocommerce/emails/email-order-details.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates/Emails
* @version 3.7.0
*/
defined('ABSPATH') || exit;
?>
<tbody>
<tr>
<td style="padding: 0 10px;" valign="top">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding: 5px 10px;" valign="top">
<table border="0" cellpadding="0" cellspacing="0" role="presentation">
<tbody>
<tr>
<td style="border-radius: 8px; padding: 14px 19px; background-color: #1595E7;" bgcolor="#1595E7" valign="top" align="center">
<?php $order_url = $sent_to_admin ? $order->get_edit_order_url() : $order->get_view_order_url(); ?>
<a class="pc-fb-font" href="<?php echo esc_url($order_url); ?>" style="text-decoration: none; word-break: break-word; line-height: 24px; letter-spacing: -0.2px; font-family: 'Fira Sans', Helvetica, Arial, sans-serif; font-size: 16px; font-weight: 500; color: #ffffff; display: block;">
<?php esc_html_e('View my order', 'woocommerce'); ?>
</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td height="25" style="line-height: 1px; font-size: 1px;">&nbsp;</td>
</tr>
</tbody>
<tbody>
<tr>
<td valign="top">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" width="100%">
<tbody>
<tr>
<td style="font-size: 0;" valign="top">
<!--[if (gte mso 9)|(IE)]><table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td width="280" valign="top"><![endif]-->
<div class="pc-sm-mw-100pc" style="display: inline-block; max-width: 280px; width: 100%; vertical-align: top;">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding: 10px 20px;" valign="top">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" width="100%">
<tbody>
<tr>
<td class="pc-fb-font" style="border-bottom: 1px solid #E5E5E5; padding-bottom: 10px; letter-spacing: -0.2px; line-height: 26px; font-family: 'Fira Sans', Helvetica, Arial, sans-serif; font-size: 16px; font-weight: bold; color: #151515;" valign="top">
<?php esc_html_e('Order number', 'woocommerce'); ?>
</td>
</tr>
<tr>
<td height="10" style="line-height: 1px; font-size: 1px;">&nbsp;</td>
</tr>
</tbody>
<tbody>
<tr>
<td class="pc-fb-font" style="letter-spacing: -0.2px; line-height: 26px; font-family: 'Fira Sans', Helvetica, Arial, sans-serif; font-size: 16px; color: #151515; padding: 10px 0 0;" valign="top">
<?php echo $order->get_order_number(); ?>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]></td><td width="280" valign="top"><![endif]-->
<div class="pc-sm-mw-100pc" style="display: inline-block; max-width: 280px; width: 100%; vertical-align: top;">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" width="100%">
<tbody>
<tr>
<td style="padding: 10px 20px;" valign="top">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" width="100%">
<tbody>
<tr>
<td class="pc-fb-font" style="border-bottom: 1px solid #E5E5E5; padding-bottom: 10px; letter-spacing: -0.2px; line-height: 26px; font-family: 'Fira Sans', Helvetica, Arial, sans-serif; font-size: 16px; font-weight: bold; color: #151515;" valign="top">
<?php esc_html_e('Order date', 'woocommerce'); ?>
</td>
</tr>
<tr>
<td height="10" style="line-height: 1px; font-size: 1px;">&nbsp;</td>
</tr>
</tbody>
<tbody>
<tr>
<td class="pc-fb-font" style="letter-spacing: -0.2px; line-height: 26px; font-family: 'Fira Sans', Helvetica, Arial, sans-serif; font-size: 16px; color: #151515; padding: 10px 0 0;" valign="top">
<?php echo $order->get_date_created()->format('F d Y'); ?>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]></td></tr></table><![endif]-->
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="height: 10px; line-height: 1px; font-size: 1px;" height="10">&nbsp;</td>
</tr>
<tr>
<td valign="top">
<?php
/*
* @hooked WC_Emails::customer_details() Shows customer details
* @hooked WC_Emails::email_address() Shows email address
*/
do_action('woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email);
?>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td height="20" style="line-height: 1px; font-size: 1px;">&nbsp;</td>
</tr>
<tr>
<td style="padding: 0 20px;" valign="top">
<?php do_action('woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text, $email); ?>
<table border="0" cellpadding="0" cellspacing="0" role="presentation" width="100%">
<tbody>
<tr>
<th class="pc-fb-font" width="400" style="letter-spacing: -0.2px; line-height: 26px; font-family: 'Fira Sans', Helvetica, Arial, sans-serif; font-size: 16px; padding: 10px 10px 10px 0; border-bottom: 1px solid #E5E5E5; color: #151515;" align="left">
<?php esc_html_e('Item', 'woocommerce'); ?>
</th>
<th class="pc-fb-font" width="44" style="letter-spacing: -0.2px; line-height: 26px; font-family: 'Fira Sans', Helvetica, Arial, sans-serif; font-size: 16px; padding: 10px 10px 10px 0; border-bottom: 1px solid #E5E5E5; color: #151515;" align="right">
<?php esc_html_e('Qty', 'woocommerce'); ?>
</th>
<th class="pc-fb-font" width="56" style="letter-spacing: -0.2px; line-height: 26px; font-family: 'Fira Sans', Helvetica, Arial, sans-serif; font-size: 16px; border-bottom: 1px solid #E5E5E5; padding: 10px 0; color: #151515;" align="right">
<?php esc_html_e('Price', 'woocommerce'); ?>
</th>
</tr>
<tr>
<td colspan="3" height="0" style="font-size: 1px; line-height: 1px;">&nbsp;</td>
</tr>
</tbody>
<tbody>
<?php
echo wc_get_email_order_items( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
$order,
array(
'show_sku' => $sent_to_admin,
'show_image' => true,
'image_size' => array(100, 100),
'plain_text' => $plain_text,
'sent_to_admin' => $sent_to_admin,
)
);
?>
</tbody>
<tbody>
<tr>
<td colspan="3" height="20" style="line-height: 1px; font-size: 1px;">&nbsp;</td>
</tr>
</tbody>
<?php
$item_totals = $order->get_order_item_totals();
if ($item_totals) {
?>
<tbody>
<?php
$i = 1;
$count_totals = count($item_totals) - 1;
foreach ($item_totals as $key => $total) {
if ($key === 'order_total') {
continue;
}
?>
<tr>
<td colspan="2" class="pc-fb-font" style="padding: 0 10px 0 0; letter-spacing: -0.2px; line-height: 26px; font-family: 'Fira Sans', Helvetica, Arial, sans-serif; font-size: 16px; <?php echo $key === 'discount' ? 'color: #40BE65;' : 'color: #151515;'; ?>" valign="top" align="right">
<?php echo wp_kses_post($total['label']); ?>
</td>
<td class="pc-fb-font" style="letter-spacing: -0.2px; line-height: 26px; font-family: 'Fira Sans', Helvetica, Arial, sans-serif; font-size: 16px; <?php
echo $key === 'discount' ? 'color: #40BE65;' : 'color: #151515;';
echo ($i === 1 || $i === $count_totals) ? 'padding: 0;' : '';
?>" valign="top" align="right">
<?php echo wp_kses_post($total['value']); ?>
</td>
</tr>
<?php
$i++;
}
?>
</tbody>
<?php if (isset($item_totals['order_total']) && is_array($item_totals['order_total'])) { ?>
<tbody>
<tr>
<td colspan="3" height="20" style="line-height: 1px; font-size: 1px;">&nbsp;</td>
</tr>
</tbody>
<tbody>
<tr>
<td class="pc-fb-font pc-sm-fs-20" colspan="2" style="padding: 20px 10px 0 0; font-family: 'Fira Sans', Helvetica, Arial, sans-serif; letter-spacing: -0.4px; line-height: 34px; font-size: 24px; border-top: 2px solid #E5E5E5; font-weight: bold; color: #151515;" valign="top" align="right">
<?php echo wp_kses_post($item_totals['order_total']['label']); ?>
</td>
<td class="pc-fb-font pc-sm-fs-20" style="padding: 20px 0 0; font-family: 'Fira Sans', Helvetica, Arial, sans-serif; letter-spacing: -0.4px; line-height: 34px; font-size: 24px; border-top: 2px solid #E5E5E5; font-weight: bold; color: #151515;" valign="top" align="right">
<?php echo wp_kses_post($item_totals['order_total']['value']); ?>
</td>
</tr>
</tbody>
<?php } ?>
<?php } ?>
<?php if ($order->get_customer_note()) { ?>
<tbody>
<tr>
<td colspan="3" height="20" style="line-height: 1px; font-size: 1px;">&nbsp;</td>
</tr>
</tbody>
<tbody>
<tr>
<td colspan="3" style="padding: 20px 0; letter-spacing: -0.2px; line-height: 24px; font-family: 'Fira Sans', Helvetica, Arial, sans-serif; font-size: 14px; border-top: 2px solid #E5E5E5; " valign="top">
<div style="margin-bottom: 10px; font-weight: bold;"><?php esc_html_e('Note:', 'woocommerce'); ?></div>
<?php echo wp_kses_post(nl2br(wptexturize($order->get_customer_note()))); ?>
</td>
</tr>
</tbody>
<?php } ?>
</table>
<?php do_action('woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text, $email); ?>
</td>
</tr>
</tbody>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.