Skip to content

Commit bc1da4a

Browse files
chore: update WC templates to latest version
1 parent 68cb45d commit bc1da4a

File tree

4 files changed

+67
-28
lines changed

4 files changed

+67
-28
lines changed

includes/wc-templates/checkout/form-login.php

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,41 @@
1414
*
1515
* @see https://woocommerce.com/document/template-structure/
1616
* @package WooCommerce\Templates
17-
* @version 3.8.0
17+
* @version 10.0.0
1818
*/
1919

2020
defined('ABSPATH') || exit;
2121

22-
if (is_user_logged_in() || 'no' === get_option('woocommerce_enable_checkout_login_reminder')) {
22+
$registration_at_checkout = WC_Checkout::instance()->is_registration_enabled();
23+
$login_reminder_at_checkout = 'yes' === get_option('woocommerce_enable_checkout_login_reminder');
24+
25+
if (is_user_logged_in()) {
2326
return;
2427
}
2528

26-
?>
27-
<div class="woocommerce-form-login-toggle">
28-
<?php wc_print_notice(apply_filters('woocommerce_checkout_login_message', esc_html__('Returning donor?', 'wc-donation-platform')) . ' <a href="#" class="showlogin">' . esc_html__('Click here to login', 'woocommerce') . '</a>', 'notice'); ?>
29-
</div>
30-
<?php
29+
if ($login_reminder_at_checkout): ?>
30+
<div class="woocommerce-form-login-toggle">
31+
<?php
32+
wc_print_notice(
33+
apply_filters('woocommerce_checkout_login_message', esc_html__('Returning donor?', 'wc-donation-platform')) . // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
34+
' <a href="#" class="showlogin">' . esc_html__('Click here to login', 'woocommerce') . '</a>',
35+
'notice'
36+
);
37+
?>
38+
</div>
39+
<?php
40+
endif;
41+
42+
if ($registration_at_checkout || $login_reminder_at_checkout):
43+
44+
// Always show the form after a login attempt.
45+
$show_form = isset($_POST['login']); // phpcs:ignore WordPress.Security.NonceVerification.Missing
3146

32-
woocommerce_login_form(
33-
array(
34-
'message' => esc_html__('Sign in with your account to contribute faster!', 'wc-donation-platform'),
35-
'redirect' => wc_get_checkout_url(),
36-
'hidden' => true,
37-
)
38-
);
47+
woocommerce_login_form(
48+
array(
49+
'message' => esc_html__('Sign in with your account to contribute faster!', 'wc-donation-platform'),
50+
'redirect' => wc_get_checkout_url(),
51+
'hidden' => !$show_form,
52+
)
53+
);
54+
endif;

includes/wc-templates/checkout/payment.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* @see https://woocommerce.com/document/template-structure/
1616
* @package WooCommerce\Templates
17-
* @version 8.1.0
17+
* @version 9.8.0
1818
*/
1919

2020
defined('ABSPATH') || exit;
@@ -24,7 +24,7 @@
2424
}
2525
?>
2626
<div id="payment" class="woocommerce-checkout-payment">
27-
<?php if (WC()->cart->needs_payment()): ?>
27+
<?php if (WC()->cart && WC()->cart->needs_payment()): ?>
2828
<ul class="wc_payment_methods payment_methods methods">
2929
<?php
3030
if (!empty($available_gateways)) {

includes/wc-templates/emails/admin-cancelled-order.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,30 @@
99
* maintain compatibility. We try to do this as little as possible, but it does
1010
* happen. When this occurs the version of the template file will be bumped and
1111
* the readme will list any important changes.
12+
*
13+
* forked from WooCommerce\Templates
1214
*
13-
* @see https://docs.woocommerce.com/document/template-structure/
15+
* @see https://woocommerce.com/document/template-structure/
1416
* @package WooCommerce\Templates\Emails
15-
* @version 4.1.0
17+
* @version 9.8.0
1618
*/
1719

20+
use Automattic\WooCommerce\Utilities\FeaturesUtil;
21+
1822
if (!defined('ABSPATH')) {
1923
exit;
2024
}
2125

26+
$email_improvements_enabled = FeaturesUtil::feature_is_enabled('email_improvements');
27+
2228
/*
2329
* @hooked WC_Emails::email_header() Output the email header
24-
*/
30+
*/
2531
do_action('woocommerce_email_header', $email_heading, $email); ?>
2632

2733
<?php /* translators: %1$s: Order number, %2$s: Customer full name */ ?>
28-
<p><?php printf(esc_html__('Notification to let you know &mdash; donation #%1$s belonging to %2$s has been cancelled:', 'wc-donation-platform'), esc_html($order->get_order_number()), esc_html($order->get_formatted_billing_full_name())); ?></p>
34+
<p><?php printf(esc_html__('Notification to let you know &mdash; donation #%1$s belonging to %2$s has been cancelled:', 'wc-donation-platform'), esc_html($order->get_order_number()), esc_html($order->get_formatted_billing_full_name())); ?>
35+
</p>
2936

3037
<?php
3138
/*
@@ -51,10 +58,12 @@
5158
* Show user-defined additional content - this is set in each email's settings.
5259
*/
5360
if ($additional_content) {
61+
echo $email_improvements_enabled ? '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td class="email-additional-content">' : '';
5462
echo wp_kses_post(wpautop(wptexturize($additional_content)));
63+
echo $email_improvements_enabled ? '</td></tr></table>' : '';
5564
}
5665

5766
/*
5867
* @hooked WC_Emails::email_footer() Output the email footer
5968
*/
60-
do_action('woocommerce_email_footer', $email);
69+
do_action('woocommerce_email_footer', $email);

includes/wc-templates/myaccount/view-order.php

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @see https://woocommerce.com/document/template-structure/
1818
* @package WooCommerce\Templates
19-
* @version 3.0.0
19+
* @version 10.1.0
2020
*/
2121

2222
defined('ABSPATH') || exit;
@@ -25,13 +25,27 @@
2525
?>
2626
<p>
2727
<?php
28-
printf(
29-
/* translators: 1: order number 2: order date 3: order status */
30-
esc_html__('Donation #%1$s was placed on %2$s and is currently %3$s.', 'wc-donation-platform'),
31-
'<mark class="order-number">' . $order->get_order_number() . '</mark>', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
32-
'<mark class="order-date">' . wc_format_datetime($order->get_date_created()) . '</mark>', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
33-
'<mark class="order-status">' . wc_get_order_status_name($order->get_status()) . '</mark>' // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
28+
echo wp_kses_post(
29+
/**
30+
* Filter to modify order detiails status text.
31+
*
32+
* @param string $order_status The order status text.
33+
*
34+
* @since 10.1.0
35+
*/
36+
apply_filters(
37+
'woocommerce_order_details_status',
38+
sprintf(
39+
/* translators: 1: order number 2: order date 3: order status */
40+
esc_html__('Donation #%1$s was placed on %2$s and is currently %3$s.', 'wc-donation-platform'),
41+
'<mark class="order-number">' . $order->get_order_number() . '</mark>', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
42+
'<mark class="order-date">' . wc_format_datetime($order->get_date_created()) . '</mark>', // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
43+
'<mark class="order-status">' . wc_get_order_status_name($order->get_status()) . '</mark>' // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
44+
),
45+
$order
46+
)
3447
);
48+
3549
?>
3650
</p>
3751

0 commit comments

Comments
 (0)