do_action('woocommerce_email_order_meta', $order, true, false);
?>

<h2><?php 
esc_html_e('New Subscription Details', 'woocommerce-subscriptions');
?>
</h2>

<?php 
foreach ($subscriptions as $subscription) {
    ?>
	<?php 
    do_action('woocommerce_email_before_subscription_table', $subscription, true, false);
    ?>
	<p><?php 
    printf(esc_html__('Subscription %s', 'woocommerce-subscriptions'), '<a href="' . esc_url(wcs_get_edit_post_link($subscription->id)) . '">' . esc_html($subscription->get_order_number()) . '</a>');
    ?>
</p>

	<table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
		<thead>
			<tr>
				<th scope="col" style="text-align:left; border: 1px solid #eee;"><?php 
    esc_html_e('Product', 'woocommerce-subscriptions');
    ?>
</th>
				<th scope="col" style="text-align:left; border: 1px solid #eee;"><?php 
    esc_html_e('Quantity', 'woocommerce-subscriptions');
    ?>
</th>
				<th scope="col" style="text-align:left; border: 1px solid #eee;"><?php 
echo date_i18n(_x('jS F Y', 'date format for order date in new switching email', 'woocommerce-subscriptions'), strtotime($order->order_date)) . "\n";
do_action('woocommerce_email_order_meta', $order, true, true);
echo "\n" . WC_Subscriptions_Email::email_order_items_table($order, array('show_download_links' => false, 'show_sku' => true, 'show_purchase_note' => '', 'show_image' => '', 'image_size' => '', 'plain_text' => true));
echo "***********\n\n";
if ($totals = $order->get_order_item_totals()) {
    foreach ($totals as $total) {
        echo $total['label'] . "\t " . $total['value'] . "\n";
    }
}
echo "\n" . sprintf(__('View order: %s', 'woocommerce-subscriptions'), wcs_get_edit_post_link($order->id)) . "\n";
echo "\n****************************************************\n\n";
do_action('woocommerce_email_after_order_table', $order, true, true);
remove_filter('woocommerce_order_item_meta_end', 'WC_Subscriptions_Switcher::print_switch_link', 10);
foreach ($subscriptions as $subscription) {
    do_action('woocommerce_email_before_subscription_table', $subscription, true, true);
    echo strtoupper(sprintf(__('Subscription number: %s', 'woocommerce-subscriptions'), $subscription->get_order_number())) . "\n";
    echo "\n" . WC_Subscriptions_Email::email_order_items_table($subscription, array('show_download_links' => false, 'show_sku' => true, 'show_purchase_note' => '', 'show_image' => '', 'image_size' => '', 'plain_text' => true));
    echo "***********\n";
    if ($totals = $subscription->get_order_item_totals()) {
        foreach ($totals as $total) {
            echo $total['label'] . "\t " . $total['value'] . "\n";
        }
    }
    echo "\n" . sprintf(__('View Subscription: %s', 'woocommerce-subscriptions'), wcs_get_edit_post_link($subscription->id)) . "\n";
    do_action('woocommerce_email_after_subscription_table', $subscription, true, true);
}
add_filter('woocommerce_order_item_meta_end', 'WC_Subscriptions_Switcher::print_switch_link', 10);
echo "\n***************************************************\n\n";
do_action('woocommerce_email_customer_details', $order, true, true);
echo "\n****************************************************\n\n";
echo apply_filters('woocommerce_email_footer_text', get_option('woocommerce_email_footer_text'));
 /**
  * Add order note to subscription to record the renewal order
  *
  * @param WC_Order|int $renewal_order
  * @param WC_Subscription|int $subscription
  * @since 2.0
  */
 public static function add_order_note($renewal_order, $subscription)
 {
     if (!is_object($subscription)) {
         $subscription = wcs_get_subscription($subscription);
     }
     if (!is_object($renewal_order)) {
         $renewal_order = wc_get_order($renewal_order);
     }
     if (is_a($renewal_order, 'WC_Order') && wcs_is_subscription($subscription)) {
         // translators: placeholder is order number, hash before order number
         $order_number = sprintf(__('#%s', 'woocommerce-subscriptions'), $renewal_order->get_order_number());
         // translators: placeholder is order ID
         $subscription->add_order_note(sprintf(__('Order %s created to record renewal.', 'woocommerce-subscriptions'), sprintf('<a href="%s">%s</a> ', esc_url(wcs_get_edit_post_link($renewal_order->id)), $order_number)));
     }
     return $renewal_order;
 }
    esc_html_e('End Date', 'woocommerce-subscriptions');
    ?>
</th>
			<th scope="col" style="text-align:left; border: 1px solid #eee;"><?php 
    esc_html_e('Price', 'woocommerce-subscriptions');
    ?>
</th>
		</tr>
	</thead>
	<tbody>
	<?php 
    foreach ($subscriptions as $subscription) {
        ?>
		<tr>
			<td scope="row" style="text-align:left; border: 1px solid #eee;"><a href="<?php 
        echo esc_url($is_admin_email ? wcs_get_edit_post_link($subscription->id) : $subscription->get_view_order_url());
        ?>
"><?php 
        echo esc_html($subscription->get_order_number());
        ?>
</a></td>
			<td scope="row" style="text-align:left; border: 1px solid #eee;"><?php 
        echo esc_html(date_i18n(wc_date_format(), $subscription->get_time('start', 'site')));
        ?>
</td>
			<td scope="row" style="text-align:left; border: 1px solid #eee;"><?php 
        echo esc_html(0 < $subscription->get_time('end') ? date_i18n(wc_date_format(), $subscription->get_time('end', 'site')) : __('When Cancelled', 'woocommerce-subscriptions'));
        ?>
</td>
			<td scope="row" style="text-align:left; border: 1px solid #eee;"><?php 
        echo wp_kses_post($subscription->get_formatted_order_total());
</th>
			<th scope="col" style="text-align:left; border: 1px solid #eee;"><?php 
echo esc_html_x('Last Payment', 'table heading', 'woocommerce-subscriptions');
?>
</th>
			<th scope="col" style="text-align:left; border: 1px solid #eee;"><?php 
echo esc_html_x('End of Prepaid Term', 'table headings in notification email', 'woocommerce-subscriptions');
?>
</th>
		</tr>
	</thead>
	<tbody>
		<tr class="order">
			<td width="1%" style="text-align:left; border: 1px solid #eee; vertical-align:middle;">
				<a href="<?php 
echo esc_url(wcs_get_edit_post_link($subscription->id));
?>
"><?php 
echo esc_html($subscription->get_order_number());
?>
</a>
			</td>
			<td style="text-align:left; border: 1px solid #eee; vertical-align:middle;">
				<?php 
echo wp_kses_post($subscription->get_formatted_order_total());
?>
			</td>
			<td style="text-align:left; border: 1px solid #eee; vertical-align:middle;">
				<?php 
echo esc_html($subscription->get_date_to_display('last_payment'));
?>
 /**
  * If the subscription is pending cancellation and a latest order is refunded, cancel the subscription.
  *
  * @param $order_id
  *
  * @since 2.0
  */
 public static function maybe_cancel_subscription_on_full_refund($order)
 {
     if (!is_object($order)) {
         $order = new WC_Order($order);
     }
     if (wcs_order_contains_subscription($order, array('parent', 'renewal'))) {
         $subscriptions = wcs_get_subscriptions_for_order($order->id, array('order_type' => array('parent', 'renewal')));
         foreach ($subscriptions as $subscription) {
             $latest_order = $subscription->get_last_order();
             if ($order->id == $latest_order && $subscription->has_status('pending-cancel') && $subscription->can_be_updated_to('cancelled')) {
                 // translators: $1: opening link tag, $2: order number, $3: closing link tag
                 $subscription->update_status('cancelled', wp_kses(sprintf(__('Subscription cancelled for refunded order %1$s#%2$s%3$s.', 'woocommerce-subscriptions'), sprintf('<a href="%s">', esc_url(wcs_get_edit_post_link($order->id))), $order->get_order_number(), '</a>'), array('a' => array('href' => true))));
             }
         }
     }
 }
 /**
  * Maybe render a renewal success message
  *
  * @since 0.2.0
  */
 public function maybe_render_renewal_success_message()
 {
     global $post_type, $pagenow;
     if ('edit.php' !== $pagenow || 'shop_subscription' !== $post_type || empty($_REQUEST['wcdh_subs_renew']) || empty($_REQUEST['id'])) {
         return;
     }
     $subscription = wcs_get_subscription(absint($_REQUEST['id']));
     if ($subscription instanceof WC_Subscription) {
         echo '<div class="updated"><p>' . sprintf(esc_html__('Subscription renewal processed. %sView Renewal Order%s', 'woocommerce-dev-helper'), '<a href="' . wcs_get_edit_post_link($subscription->get_last_order()) . '">', ' &#8594;</a>') . '</p></div>';
     }
 }
<?php

/**
 * Subscription information template
 *
 * @author	Brent Shepherd / Chuck Mac
 * @package WooCommerce_Subscriptions/Templates/Emails
 * @version 1.5
 */
if (!defined('ABSPATH')) {
    exit;
    // Exit if accessed directly
}
if (!empty($subscriptions)) {
    echo __('Subscription Information:', 'woocommerce-subscriptions') . "\n\n";
    foreach ($subscriptions as $subscription) {
        echo __('Subscription', 'woocommerce-subscriptions') . ': ' . $subscription->get_order_number() . "\n";
        echo __('View Subscription', 'woocommerce-subscriptions') . ': ' . ($is_admin_email ? wcs_get_edit_post_link($subscription->id) : $subscription->get_view_order_url()) . "\n";
        echo __('Start Date', 'woocommerce-subscriptions') . ': ' . date_i18n(wc_date_format(), $subscription->get_time('start', 'site')) . "\n";
        echo __('End Date', 'woocommerce-subscriptions') . ': ' . (0 < $subscription->get_time('end') ? date_i18n(wc_date_format(), $subscription->get_time('end', 'site')) : __('When Cancelled', 'woocommerce-subscriptions')) . "\n";
        echo __('Price', 'woocommerce-subscriptions') . ': ' . $subscription->get_formatted_order_total();
        echo "\n\n";
    }
    echo "\n****************************************************\n\n";
}
<?php

/**
 * Subscription information template
 *
 * @author	Brent Shepherd / Chuck Mac
 * @package WooCommerce_Subscriptions/Templates/Emails
 * @version 1.5
 */
if (!defined('ABSPATH')) {
    exit;
    // Exit if accessed directly
}
if (!empty($subscriptions)) {
    echo __('Subscription Information:', 'woocommerce-subscriptions') . "\n\n";
    foreach ($subscriptions as $subscription) {
        // translators: placeholder is subscription's number
        printf(_x('Subscription: %s', 'in plain emails for subscription information', 'woocommerce-subscriptions'), $subscription->get_order_number()) . "\n";
        // translators: placeholder is either view or edit url for the subscription
        printf(_x('View Subscription: %s', 'in plain emails for subscription information', 'woocommerce-subscriptions'), $is_admin_email ? wcs_get_edit_post_link($subscription->id) : $subscription->get_view_order_url()) . "\n";
        // translators: placeholder is localised start date
        printf(_x('Start Date: %s', 'in plain emails for subscription information', 'woocommerce-subscriptions'), date_i18n(wc_date_format(), $subscription->get_time('start', 'site'))) . "\n";
        $end_date = 0 < $subscription->get_time('end') ? date_i18n(wc_date_format(), $subscription->get_time('end', 'site')) : _x('When Cancelled', 'Used as end date for an indefinite subscription', 'woocommerce-subscriptions');
        // translators: placeholder is localised end date, or "when cancelled"
        printf(_x('End Date: %s', 'in plain emails for subscription information', 'woocommerce-subscriptions'), $end_date) . "\n";
        // translators: placeholder is the formatted order total for the subscription
        echo _x('Price: %s', 'in plain emails for subscription information', 'woocommerce-subscriptions') . ': ' . $subscription->get_formatted_order_total();
        echo "\n\n";
    }
    echo "\n****************************************************\n\n";
}
echo "\n" . WC_Subscriptions_Email::email_order_items_table($order, array('show_download_links' => false, 'show_sku' => true, 'show_purchase_note' => '', 'show_image' => '', 'image_size' => '', 'plain_text' => true));
echo "***********\n\n";
if ($totals = $order->get_order_item_totals()) {
    foreach ($totals as $total) {
        echo $total['label'] . "\t " . $total['value'] . "\n";
    }
}
// translators: placeholder is edit post link for the order
echo "\n" . sprintf(__('View order: %s', 'woocommerce-subscriptions'), wcs_get_edit_post_link($order->id)) . "\n";
echo "\n****************************************************\n\n";
do_action('woocommerce_email_after_order_table', $order, true, true);
remove_filter('woocommerce_order_item_meta_end', 'WC_Subscriptions_Switcher::print_switch_link', 10);
foreach ($subscriptions as $subscription) {
    do_action('woocommerce_email_before_subscription_table', $subscription, true, true);
    echo strtoupper(sprintf(__('Subscription Number: %s', 'woocommerce-subscriptions'), $subscription->get_order_number())) . "\n";
    echo "\n" . WC_Subscriptions_Email::email_order_items_table($subscription, array('show_download_links' => false, 'show_sku' => true, 'show_purchase_note' => '', 'show_image' => '', 'image_size' => '', 'plain_text' => true));
    echo "***********\n";
    if ($totals = $subscription->get_order_item_totals()) {
        foreach ($totals as $total) {
            echo $total['label'] . "\t " . $total['value'] . "\n";
        }
    }
    // translators: placeholder is edit post link for the subscription
    echo "\n" . sprintf(_x('View Subscription: %s', 'in plain emails for subscription information', 'woocommerce-subscriptions'), wcs_get_edit_post_link($subscription->id)) . "\n";
    do_action('woocommerce_email_after_subscription_table', $subscription, true, true);
}
add_filter('woocommerce_order_item_meta_end', 'WC_Subscriptions_Switcher::print_switch_link', 10);
echo "\n***************************************************\n\n";
do_action('woocommerce_email_customer_details', $order, true, true);
echo "\n****************************************************\n\n";
echo apply_filters('woocommerce_email_footer_text', get_option('woocommerce_email_footer_text'));