recurring-totals.php
4.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
/**
* Recurring totals
*
* @author Prospress
* @package WooCommerce Subscriptions/Templates
* @version 2.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$display_th = true;
?>
<tr class="recurring-totals">
<th colspan="2"><?php esc_html_e( 'Recurring Totals', 'woocommerce-subscriptions' ); ?></th>
</tr>
<?php foreach ( $recurring_carts as $recurring_cart_key => $recurring_cart ) : ?>
<?php if ( 0 == $recurring_cart->next_payment_date ) : ?>
<?php continue; ?>
<?php endif; ?>
<tr class="cart-subtotal recurring-total">
<?php if ( $display_th ) : $display_th = false; ?>
<th rowspan="<?php echo esc_attr( $carts_with_multiple_payments ); ?>"><?php esc_html_e( 'Subtotal', 'woocommerce-subscriptions' ); ?></th>
<?php endif; ?>
<td><?php wcs_cart_totals_subtotal_html( $recurring_cart ); ?></td>
</tr>
<?php endforeach; ?>
<?php $display_th = true; ?>
<?php foreach ( WC()->cart->get_coupons() as $code => $coupon ) : ?>
<?php foreach ( $recurring_carts as $recurring_cart_key => $recurring_cart ) : ?>
<?php if ( 0 == $recurring_cart->next_payment_date ) : ?>
<?php continue; ?>
<?php endif; ?>
<?php foreach ( $recurring_cart->get_coupons() as $recurring_code => $recurring_coupon ) : ?>
<?php if ( $recurring_code !== $code ) { continue; } ?>
<tr class="cart-discount coupon-<?php echo esc_attr( $code ); ?> recurring-total">
<?php if ( $display_th ) : $display_th = false; ?>
<th rowspan="<?php echo esc_attr( $carts_with_multiple_payments ); ?>"><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
<?php endif; ?>
<td><?php wcs_cart_totals_coupon_html( $recurring_coupon, $recurring_cart ); ?></td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
<?php $display_th = true; ?>
<?php endforeach; ?>
<?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
<?php wcs_cart_totals_shipping_html(); ?>
<?php endif; ?>
<?php if ( WC()->cart->tax_display_cart === 'excl' ) : ?>
<?php if ( get_option( 'woocommerce_tax_total_display' ) === 'itemized' ) : ?>
<?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : ?>
<?php foreach ( $recurring_carts as $recurring_cart_key => $recurring_cart ) : ?>
<?php if ( 0 == $recurring_cart->next_payment_date ) : ?>
<?php continue; ?>
<?php endif; ?>
<?php foreach ( $recurring_cart->get_tax_totals() as $recurring_code => $recurring_tax ) : ?>
<?php if ( $recurring_code !== $code ) { continue; } ?>
<tr class="tax-rate tax-rate-<?php echo esc_attr( sanitize_title( $code ) ); ?> recurring-total">
<?php if ( $display_th ) : $display_th = false; ?>
<th><?php echo esc_html( $recurring_tax->label ); ?></th>
<?php else : ?>
<th></th>
<?php endif; ?>
<td><?php echo wp_kses_post( wcs_cart_price_string( $recurring_tax->formatted_amount, $recurring_cart ) ); ?></td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
<?php $display_th = true; ?>
<?php endforeach; ?>
<?php else : ?>
<?php foreach ( $recurring_carts as $recurring_cart_key => $recurring_cart ) : ?>
<?php if ( 0 == $recurring_cart->next_payment_date ) : ?>
<?php continue; ?>
<?php endif; ?>
<tr class="tax-total recurring-total">
<?php if ( $display_th ) : $display_th = false; ?>
<th><?php echo esc_html( WC()->countries->tax_or_vat() ); ?></th>
<?php else : ?>
<th></th>
<?php endif; ?>
<td><?php echo wp_kses_post( wcs_cart_price_string( $recurring_cart->get_taxes_total(), $recurring_cart ) ); ?></td>
</tr>
<?php endforeach; ?>
<?php $display_th = true; ?>
<?php endif; ?>
<?php endif; ?>
<?php foreach ( $recurring_carts as $recurring_cart_key => $recurring_cart ) : ?>
<?php if ( 0 == $recurring_cart->next_payment_date ) : ?>
<?php continue; ?>
<?php endif; ?>
<tr class="order-total recurring-total">
<?php if ( $display_th ) : $display_th = false; ?>
<th rowspan="<?php echo esc_attr( $carts_with_multiple_payments ); ?>"><?php esc_html_e( 'Recurring Total', 'woocommerce-subscriptions' ); ?></th>
<?php endif; ?>
<td><?php wcs_cart_totals_order_total_html( $recurring_cart ); ?></td>
</tr>
<?php endforeach; ?>