PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / trunk
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler vtrunk
1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 All 49 releases
fluent-cart / app / Views / emails / subscription / upcoming_charge / customer.php

customer.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler trunk, at app/Views/emails/subscription/upcoming_charge/customer.php

93 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
2 <?php
3 /**
4 * Upcoming automatic charge notice — sent when a renewal order is created for a
5 * system (auto-charged) subscription, ahead of the due-date charge.
6 *
7 * @var \FluentCart\App\Models\Order $order The renewal order (payment_scheduled)
8 * @var \FluentCart\App\Models\Subscription $subscription
9 */
10
11 $paymentMethodText = $subscription->getPaymentMethodText();
12
13 // getCustomerDashboardUrl() returns a broken relative path ("/subscription/{uuid}")
14 // when no customer profile page is configured — only render the CTA when the
15 // dashboard base actually exists.
16 $manageUrl = (new \FluentCart\Api\StoreSettings())->getCustomerProfilePage()
17 ? \FluentCart\App\Services\URL::getCustomerDashboardUrl('subscription/' . $subscription->uuid)
18 : '';
19
20 // The charge fires on the renewal due date. Always state the DATE — never a
21 // countdown: daily-interval renewals are created at the due date itself.
22 $dueDate = $order->getMeta('due_date') ?: $order->created_at;
23 $formattedChargeDate = $dueDate
24 ? \FluentCart\App\Services\DateTime\DateTime::gmtToTimezone($dueDate)->format(get_option('date_format'))
25 : '';
26
27 $formattedAmount = \FluentCart\Api\CurrencySettings::getFormattedPrice($order->total_amount, null, false, true, true);
28 ?>
29
30 <div class="space_bottom_30">
31 <p>
32 <?php
33 printf(
34 /* translators: %1$s is the customer's full name */
35 esc_html__( 'Hello %1$s,', 'fluent-cart' ),
36 esc_html($order->customer->full_name)
37 );
38 ?>
39 </p>
40
41 <p>
42 <?php
43 if ($formattedChargeDate && $paymentMethodText) {
44 printf(
45 /* translators: %1$s is the subscription item name, %2$s is the charge amount, %3$s is the charge date, %4$s is the saved payment method (e.g. visa ***4242) */
46 esc_html__( 'Your subscription %1$s renews soon. We will automatically charge %2$s to your saved payment method (%4$s) on %3$s.', 'fluent-cart' ),
47 '<strong>' . esc_html( $subscription->item_name ) . '</strong>',
48 '<strong>' . esc_html( $formattedAmount ) . '</strong>',
49 '<strong>' . esc_html( $formattedChargeDate ) . '</strong>',
50 esc_html( $paymentMethodText )
51 );
52 } elseif ($formattedChargeDate) {
53 printf(
54 /* translators: %1$s is the subscription item name, %2$s is the charge amount, %3$s is the charge date */
55 esc_html__( 'Your subscription %1$s renews soon. We will automatically charge %2$s to your saved payment method on %3$s.', 'fluent-cart' ),
56 '<strong>' . esc_html( $subscription->item_name ) . '</strong>',
57 '<strong>' . esc_html( $formattedAmount ) . '</strong>',
58 '<strong>' . esc_html( $formattedChargeDate ) . '</strong>'
59 );
60 } else {
61 printf(
62 /* translators: %1$s is the subscription item name, %2$s is the charge amount */
63 esc_html__( 'Your subscription %1$s renews soon. We will automatically charge %2$s to your saved payment method.', 'fluent-cart' ),
64 '<strong>' . esc_html( $subscription->item_name ) . '</strong>',
65 '<strong>' . esc_html( $formattedAmount ) . '</strong>'
66 );
67 }
68 ?>
69 </p>
70
71 <p>
72 <?php esc_html_e( 'No action is needed — this is a notice so the charge does not surprise you.', 'fluent-cart' ); ?>
73 </p>
74 </div>
75
76 <?php
77
78 \FluentCart\App\App::make('view')->render('emails.parts.items_table', [
79 'order' => $order,
80 'formattedItems' => $order->order_items,
81 'heading' => __('Renewal Summary', 'fluent-cart'),
82 ]);
83
84 echo '<hr />';
85
86 if ($manageUrl) {
87 \FluentCart\App\App::make('view')->render('emails.parts.call_to_action_box', [
88 'content' => esc_html__( 'Need to change the card, pause, or cancel before the charge? Manage your subscription from your account.', 'fluent-cart' ),
89 'link' => $manageUrl,
90 'button_text' => __('Manage Subscription', 'fluent-cart'),
91 ]);
92 }
93