PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.0
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.0
1.7.0 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 All 50 releases
← All changes | app/Services/Renderer/Receipt/ThankYouRender.php +194 -131 1.5.2 → 1.7.0 View file →
@@ -4,8 +4,9 @@
4 4
5 5 use FluentCart\Api\StoreSettings;
6 6 use FluentCart\App\App;
7 7 use FluentCart\App\Helpers\Helper;
8 +use FluentCart\App\Helpers\Status;
8 9 use FluentCart\App\Modules\Tax\TaxModule;
9 10 use FluentCart\App\Modules\Templating\AssetLoader;
10 11 use FluentCart\App\Vite;
11 12 use FluentCart\Framework\Support\Arr;
@@ -21,8 +22,9 @@
21 22 protected $is_first_time = false;
22 23
23 24 protected $order_operation = null;
24 25
26 + private $fctTaxSummaryCache = [];
25 27
26 28 public function __construct($config)
27 29 {
28 30 $this->config = $config;
@@ -34,8 +36,20 @@
34 36 AssetLoader::enqueueThankYouPageAssets();
35 37
36 38 }
37 39
40 + private function getMemoizedTaxSummary($order)
41 + {
42 + if (!$order) {
43 + return TaxSummaryHelper::computeTaxSummary($order);
44 + }
45 + $id = (int) $order->id;
46 + if (!isset($this->fctTaxSummaryCache[$id])) {
47 + $this->fctTaxSummaryCache[$id] = TaxSummaryHelper::computeTaxSummary($order);
48 + }
49 + return $this->fctTaxSummaryCache[$id];
50 + }
51 +
38 52 public function renderWrapperStart()
39 53 {
40 54 ?>
41 55 <div class="fct-thank-you-page">
@@ -92,47 +106,79 @@
92 106 ]);
93 107 }
94 108 }
95 109
110 + protected function getHeaderState()
111 + {
112 + $order = Arr::get($this->config, 'order', null);
113 + $status = $order ? $order->payment_status : '';
114 +
115 + if ($status === Status::PAYMENT_REFUNDED) {
116 + return 'refunded';
117 + }
118 + if ($status === Status::PAYMENT_FAILED) {
119 + return 'failed';
120 + }
121 + if (in_array($status, [Status::PAYMENT_PAID, Status::PAYMENT_PARTIALLY_REFUNDED], true)) {
122 + return 'success';
123 + }
124 +
125 + return 'pending';
126 + }
127 +
96 128 public function renderHeader()
97 129 {
98 - $bgColor = '#d4edda';
99 - $titleColor = '#155724';
100 - $iconBg = '#155724bd';
130 + $state = $this->getHeaderState();
101 131
102 - $order = Arr::get($this->config, 'order', null);
132 + $styles = [
133 + 'success' => ['bg' => '#d4edda', 'title' => '#155724', 'iconBg' => '#155724bd'],
134 + 'pending' => ['bg' => '#fff3cd', 'title' => '#856404', 'iconBg' => '#856404bd'],
135 + 'failed' => ['bg' => '#f8d7da', 'title' => '#721c24', 'iconBg' => '#721c24bd'],
136 + 'refunded' => ['bg' => '#e2e3e5', 'title' => '#383d41', 'iconBg' => '#383d41bd'],
137 + ];
103 138
104 - if ($order->payment_status !== 'paid') {
105 - $bgColor = '#fff3cd';
106 - $titleColor = '#856404';
107 - $iconBg = '#856404bd';
108 - }
139 + $titles = [
140 + 'success' => __('Purchase Successful!', 'fluent-cart'),
141 + 'pending' => __('Payment Pending!', 'fluent-cart'),
142 + 'failed' => __('Payment Failed', 'fluent-cart'),
143 + 'refunded' => __('Order Refunded', 'fluent-cart'),
144 + ];
145 +
146 + $bgColor = $styles[$state]['bg'];
147 + $titleColor = $styles[$state]['title'];
148 + $iconBg = $styles[$state]['iconBg'];
109 149 ?>
110 150 <div class="fct-thank-you-page-header" style="background: <?php echo esc_attr($bgColor); ?>;">
111 - <?php if ($order->payment_status !== 'paid') : ?>
112 - <div class="fct-thank-you-page-header-icon" style="background: <?php echo esc_attr($iconBg); ?>;">
151 + <div class="fct-thank-you-page-header-icon" style="background: <?php echo esc_attr($iconBg); ?>;">
152 + <?php if ($state === 'success') : ?>
153 + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor"
154 + stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
155 + <polyline points="20,6 9,17 4,12"></polyline>
156 + </svg>
157 + <?php elseif ($state === 'failed') : ?>
158 + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor"
159 + stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
160 + <line x1="18" y1="6" x2="6" y2="18"></line>
161 + <line x1="6" y1="6" x2="18" y2="18"></line>
162 + </svg>
163 + <?php elseif ($state === 'refunded') : ?>
164 + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor"
165 + stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
166 + <polyline points="9,14 4,9 9,4"></polyline>
167 + <path d="M4 9h10a6 6 0 0 1 0 12h-3"></path>
168 + </svg>
169 + <?php else : ?>
113 170 <svg class="w-64 h-64" xmlns="http://www.w3.org/2000/svg"
114 171 viewBox="0 0 1024 1024" fill="currentColor">
115 172 <path
116 173 d="M480 674V192c0-18 14-32 32-32s32 14 32 32v482h-64zm0 63h64v60h-64v-60zM0 512C0 229 229 0 512 0s512 229 512 512-229 512-512 512S0 795 0 512zm961 0c0-247-202-448-449-448S64 265 64 512s201 448 448 448 449-201 449-448z"></path>
117 174 </svg>
118 - </div>
119 - <h1 class="fct-thank-you-page-header-title" style="color:<?php echo esc_attr($titleColor); ?>">
120 - <?php echo esc_html__('Payment Pending!', 'fluent-cart'); ?>
121 - </h1>
175 + <?php endif; ?>
176 + </div>
177 + <h1 class="fct-thank-you-page-header-title" style="color:<?php echo esc_attr($titleColor); ?>;">
178 + <?php echo esc_html($titles[$state]); ?>
179 + </h1>
122 180
123 - <?php else: ?>
124 - <div class="fct-thank-you-page-header-icon" style="background: <?php echo esc_attr($iconBg); ?>;">
125 - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor"
126 - stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
127 - <polyline points="20,6 9,17 4,12"></polyline>
128 - </svg>
129 - </div>
130 - <h1 class="fct-thank-you-page-header-title" style="color:<?php echo esc_attr($titleColor); ?>;">
131 - <?php echo esc_html__('Purchase Successful!', 'fluent-cart'); ?>
132 - </h1>
133 - <?php endif; ?>
134 -
135 181 <?php do_action('fluent_cart/receipt/thank_you/after_header_title', $this->config); ?>
136 182
137 183 </div>
138 184
@@ -193,9 +239,10 @@
193 239 esc_html($order->customer->full_name)
194 240 );
195 241 ?>
196 242 </div>
197 - <?php if ($order->payment_status === 'paid') : ?>
243 + <?php $state = $this->getHeaderState(); ?>
244 + <?php if ($state === 'success') : ?>
198 245 <p>
199 246 <?php
200 247 printf(
201 248 '%s<strong style="color: #007bff;"><a href="%s">#%s</a></strong>%s',
@@ -205,8 +252,34 @@
205 252 esc_html__(' has been placed successfully.', 'fluent-cart')
206 253 );
207 254 ?>
208 255 </p>
256 + <?php elseif ($state === 'refunded') : ?>
257 + <p>
258 + <?php
259 + printf(
260 + '%s<strong style="color: #007bff;"><a href="%s">#%s</a></strong>%s',
261 + esc_html__('Your order ', 'fluent-cart'),
262 + esc_url($profilePage . 'order/' . $order->uuid),
263 + esc_html($order->invoice_no),
264 + esc_html__(' has been refunded.', 'fluent-cart')
265 + );
266 + ?>
267 + </p>
268 + <?php elseif ($state === 'failed') : ?>
269 + <p>
270 + <?php
271 + printf(
272 + '%s<strong style="color: #007bff;"><a href="%s">#%s</a></strong>%s <a style="color: #007bff;" target="_blank" href="%s">%s</a>.',
273 + esc_html__('The payment for your order ', 'fluent-cart'),
274 + esc_url($profilePage . 'order/' . $order->uuid),
275 + esc_html($order->invoice_no),
276 + esc_html__(' could not be completed. You can try again from', 'fluent-cart'),
277 + esc_url(\FluentCart\App\Services\Payments\PaymentHelper::getCustomPaymentLink($order->uuid)),
278 + esc_html__('here', 'fluent-cart')
279 + );
280 + ?>
281 + </p>
209 282 <?php else: ?>
210 283 <p>
211 284
212 285 <?php
@@ -277,8 +350,9 @@
277 350
278 351 public function renderOrderItemsBody()
279 352 {
280 353 $order = Arr::get($this->config, 'order', null);
354 + $fctTaxDisplayMode = TaxSummaryHelper::getTaxDisplayMode();
281 355 ?>
282 356 <div class="fct-thank-you-page-order-items-body">
283 357 <?php
284 358 $order->loadMissing(['order_items']);
@@ -314,9 +388,11 @@
314 388 </div>
315 389 </div>
316 390
317 391 <div class="fct-thank-you-page-order-items-tax-info">
318 - <?php $this->renderItemTaxPill($item, $order); ?>
392 + <?php if ($fctTaxDisplayMode !== 'simplified'): ?>
393 + <?php $this->renderItemTaxPill($item, $order); ?>
394 + <?php endif; ?>
319 395 <?php if (!empty($item['setup_info'])): ?>
320 396 <div class="fct-thank-you-page-order-items-setup-fee">
321 397 <div class="setup-fee">
322 398 <?php echo esc_html(Arr::get($item, 'other_info.signup_fee_name', '')); ?>
@@ -326,9 +402,11 @@
326 402 <?php echo esc_html(Helper::toDecimal(Arr::get($item, 'other_info.signup_fee', ''))); ?>
327 403 </div>
328 404 </div>
329 405 <?php endif; ?>
330 - <?php $this->renderItemSetupFeeTaxPills($item, $order); ?>
406 + <?php if ($fctTaxDisplayMode !== 'simplified'): ?>
407 + <?php $this->renderItemSetupFeeTaxPills($item, $order); ?>
408 + <?php endif; ?>
331 409 </div>
332 410 <?php endforeach; ?>
333 411
334 412 <?php $this->renderOrderTotal(); ?>
@@ -392,9 +470,9 @@
392 470 {
393 471 $order = Arr::get($this->config, 'order', null);
394 472 if ($order->isReverseChargeTaxOrder()): ?>
395 473 <div style="text-align: right; font-size: 14px; margin-top: 10px;">
396 - <?php echo '*' . esc_html__('Tax to be paid on reverse charge basis', 'fluent-cart') ?>
474 + <?php echo '*' . esc_html(TaxModule::getReverseChargeNoticeText()) ?>
397 475 </div>
398 476 <?php
399 477 endif;
400 478 }
@@ -466,17 +544,21 @@
466 544 return;
467 545 }
468 546 $displayShipping = (int) $order->shipping_total;
469 547 if ($order->isReverseChargeTaxOrder()) {
470 - $rcAdj = (int) Arr::get(TaxSummaryHelper::computeTaxSummary($order), 'rcShippingAdjustment', 0);
548 + $rcAdj = (int) Arr::get($this->getMemoizedTaxSummary($order), 'rcShippingAdjustment', 0);
471 549 if ($rcAdj > 0) {
472 550 $displayShipping = max(0, $displayShipping - $rcAdj);
473 551 }
474 552 }
553 + $shippingMethodTitle = (string) Arr::get($order->config, 'shipping_method_title', '');
475 554 ?>
476 555 <div class="fct-meta-line fct-thank-you-page-order-items-total-shipping">
477 556 <div class="fct-meta-line-label fct-thank-you-page-order-items-total-label">
478 557 <?php echo esc_html__('Shipping', 'fluent-cart'); ?>
558 + <?php if ($shippingMethodTitle): ?>
559 + <span class="fct-shipping-method-name"><?php echo esc_html($shippingMethodTitle); ?></span>
560 + <?php endif; ?>
479 561 </div>
480 562 <div class="fct-meta-line-value fct-thank-you-page-order-items-total-value"><?php echo esc_html(Helper::toDecimal($displayShipping)); ?></div>
481 563 </div>
482 564 <?php
@@ -500,64 +582,8 @@
500 582 </div>
501 583 <?php endforeach;
502 584 }
503 585
504 - public function renderTaxTotal()
505 - {
506 - $order = Arr::get($this->config, 'order', null);
507 -
508 - if ($order->isReverseChargeTaxOrder()): ?>
509 - <?php
510 - $rcReversedTotal = $order->getReversedTaxTotal();
511 - $rcChargeLabel = $rcReversedTotal > 0
512 - ? sprintf(
513 - /* translators: %1$s: formatted reversed tax amount */
514 - __('Tax reversed: %1$s', 'fluent-cart'),
515 - Helper::toDecimal($rcReversedTotal)
516 - )
517 - : __('Charge reversed', 'fluent-cart');
518 - ?>
519 - <div class="fct-meta-line fct-thank-you-page-order-items-total-tax">
520 - <div class="fct-meta-line-label fct-thank-you-page-order-items-total-label">
521 - <?php echo esc_html__('Tax', 'fluent-cart'); ?>
522 - </div>
523 - <div class="fct-meta-line-value fct-thank-you-page-order-items-total-value">
524 - <?php echo esc_html($rcChargeLabel); ?>
525 - </div>
526 - </div>
527 - <?php elseif ($order->tax_total > 0): ?>
528 - <div class="fct-meta-line fct-thank-you-page-order-items-total-tax">
529 - <div class="fct-meta-line-label fct-thank-you-page-order-items-total-label">
530 - <?php echo esc_html__('Total Tax', 'fluent-cart'); ?>
531 - <?php echo \FluentCart\App\Helpers\Helper::getOrderTaxLabel($order); ?>
532 - </div>
533 - <div class="fct-meta-line-value fct-thank-you-page-order-items-total-value">
534 - <?php echo esc_html(Helper::toDecimal($order->tax_total)); ?>
535 - </div>
536 - </div>
537 - <?php endif;
538 - }
539 -
540 - public function renderShippingTax()
541 - {
542 - $order = Arr::get($this->config, 'order', null);
543 -
544 - if ($order->shipping_tax <= 0) {
545 - return;
546 - }
547 - ?>
548 - <div class="fct-meta-line fct-thank-you-page-order-items-total-shipping-tax">
549 - <div class="fct-meta-line-label fct-thank-you-page-order-items-total-label">
550 - <?php echo esc_html__('Shipping Tax', 'fluent-cart'); ?>
551 - <?php echo \FluentCart\App\Helpers\Helper::getOrderTaxLabel($order); ?>
552 - </div>
553 - <div class="fct-meta-line-value fct-thank-you-page-order-items-total-value">
554 - <?php echo esc_html(Helper::toDecimal($order->shipping_tax)); ?>
555 - </div>
556 - </div>
557 - <?php
558 - }
559 -
560 586 public function renderRefund()
561 587 {
562 588 $order = Arr::get($this->config, 'order', null);
563 589
@@ -577,9 +603,9 @@
577 603 {
578 604 $order = Arr::get($this->config, 'order', null);
579 605 $displayTotal = (int) $order->total_amount - (int) $order->total_refund;
580 606 if ($order->isReverseChargeTaxOrder()) {
581 - $rcAdj = (int) Arr::get(TaxSummaryHelper::computeTaxSummary($order), 'rcTotalAdjustment', 0);
607 + $rcAdj = (int) Arr::get($this->getMemoizedTaxSummary($order), 'rcTotalAdjustment', 0);
582 608 if ($rcAdj > 0) {
583 609 $displayTotal = max(0, $displayTotal - $rcAdj);
584 610 }
585 611 }
@@ -655,9 +681,9 @@
655 681 echo sprintf(
656 682 /* translators: 1: Next billing date */
657 683 esc_html__('- Auto renews on %1$s', 'fluent-cart'),
658 684 esc_html(
659 - \FluentCart\App\Services\DateTime\DateTime::gmtToTimezone($subs->next_billing_date)->format('M d, Y h:i A')
685 + \FluentCart\App\Services\DateTime\DateFormatter::format($subs->next_billing_date, true, $order)
660 686 )
661 687 );
662 688 ?>
663 689 </p>
@@ -1111,17 +1137,47 @@
1111 1137
1112 1138 public function renderTaxSummaryBox()
1113 1139 {
1114 1140 $order = Arr::get($this->config, 'order', null);
1115 - $summary = TaxSummaryHelper::computeTaxSummary($order);
1141 + $summary = $this->getMemoizedTaxSummary($order);
1116 1142 if (!$summary['shouldRender']) {
1117 1143 return;
1118 1144 }
1145 +
1146 + $tyIsSimplified = (($summary['displayMode'] ?? '') === 'simplified') && !empty($summary['simpleLine']);
1147 +
1148 + if ($tyIsSimplified) :
1149 + ?>
1150 + <div class="fct-meta-line fct-thank-you-tax-simple-line">
1151 + <div class="fct-meta-line-label fct-thank-you-page-order-items-total-label fct-thank-you-tax-simple-label">
1152 + <span><?php echo esc_html($summary['simpleLine']['label']); ?></span>
1153 + <?php if (!empty($summary['simpleLine']['hasDetails'])) : ?>
1154 + <details class="fct-thank-you-tax-details">
1155 + <summary class="fct-thank-you-tax-toggle"><?php echo esc_html__('See details', 'fluent-cart'); ?> &#9662;</summary>
1156 + <div class="fct-thank-you-tax-summary fct-thank-you-tax-floating">
1157 + <?php $this->renderTaxBreakdownCardInner($summary); ?>
1158 + </div>
1159 + </details>
1160 + <?php endif; ?>
1161 + </div>
1162 + <div class="fct-meta-line-value fct-thank-you-page-order-items-total-value"><?php echo esc_html($summary['simpleLine']['value']); ?></div>
1163 + </div>
1164 + <?php
1165 + else :
1166 + ?>
1167 + <div class="fct-thank-you-tax-summary">
1168 + <?php $this->renderTaxBreakdownCardInner($summary); ?>
1169 + </div>
1170 + <?php
1171 + endif;
1172 + }
1173 +
1174 + private function renderTaxBreakdownCardInner($summary)
1175 + {
1119 1176 ?>
1120 - <div class="fct-thank-you-tax-summary">
1121 1177 <div class="fct-thank-you-tax-summary-header">
1122 1178 <span class="fct-thank-you-tax-summary-title">
1123 - <?php if (!$summary['isReverseCharge'] && !empty(Arr::get($summary, 'foldedRateLines', []))): ?>
1179 + <?php if (!empty(Arr::get($summary, 'foldedRateLines', []))): ?>
1124 1180 <?php echo esc_html__('Tax breakdown by rate', 'fluent-cart'); ?>
1125 1181 <?php else: ?>
1126 1182 <?php echo esc_html__('TAX SUMMARY', 'fluent-cart'); ?>
1127 1183 <?php endif; ?>
@@ -1134,50 +1190,42 @@
1134 1190 </span>
1135 1191 </span>
1136 1192 </div>
1137 1193
1138 - <?php if ($summary['isReverseCharge']): ?>
1194 + <?php
1195 + $tyFoldedRateLines = Arr::get($summary, 'foldedRateLines', []);
1196 + $tyIsReverseCharge = !empty($summary['isReverseCharge']);
1197 + $rcReversedTotal = (int) Arr::get($summary, 'reversedTaxTotal', 0);
1198 + $rcReversedShipping = (int) Arr::get($summary, 'reversedShippingTax', 0);
1199 + $rcReversedValue = $rcReversedTotal > 0
1200 + ? Helper::toDecimal($rcReversedTotal)
1201 + : __('Charge reversed', 'fluent-cart');
1202 + ?>
1203 + <?php if (!empty($tyFoldedRateLines)): ?>
1139 1204 <?php
1140 - $rcReversedTotal = (int) Arr::get($summary, 'reversedTaxTotal', 0);
1141 - $rcReversedShipping = (int) Arr::get($summary, 'reversedShippingTax', 0);
1142 - $rcReversedValue = $rcReversedTotal > 0
1143 - ? Helper::toDecimal($rcReversedTotal)
1144 - : __('Charge reversed', 'fluent-cart');
1145 - ?>
1146 - <?php if ($summary['showRcShippingRow'] && $rcReversedShipping > 0): ?>
1147 - <div class="fct-thank-you-tax-summary-row fct-thank-you-tax-summary-row--muted">
1148 - <span><?php echo esc_html__('Added on shipping', 'fluent-cart'); ?></span>
1149 - <span style="text-decoration:line-through;opacity:0.6;"><?php echo esc_html(Helper::toDecimal($rcReversedShipping)); ?></span>
1150 - </div>
1151 - <?php endif; ?>
1152 - <div class="fct-thank-you-tax-summary-row fct-thank-you-tax-summary-row--total">
1153 - <span><?php echo esc_html__('Tax reversed', 'fluent-cart'); ?></span>
1154 - <span><?php echo esc_html($rcReversedValue); ?></span>
1155 - </div>
1156 - <?php else: ?>
1157 - <?php
1158 - $tyFoldedRateLines = Arr::get($summary, 'foldedRateLines', []);
1159 1205 $tyIncludedInPrices = (int) Arr::get($summary, 'includedInPrices', 0);
1160 1206 $tyPayableTax = (int) Arr::get($summary, 'payableTax', 0);
1161 1207 $tyTotalOrderTax = (int) Arr::get($summary, 'totalOrderTax', 0);
1162 - $tyFeeRows = Arr::get($summary, 'feeTaxLineRows', []);
1163 - $taxRateLines = Arr::get($summary, 'taxRateLines', []);
1164 - $shippingTaxLines = Arr::get($summary, 'shippingTaxLines', []);
1165 1208 ?>
1166 - <?php if (!empty($tyFoldedRateLines)): ?>
1167 - <div style="display:grid;grid-template-columns:minmax(0,1fr) 92px 64px;column-gap:12px;align-items:start;">
1168 - <span style="min-width:0;font-size:11px;text-transform:uppercase;letter-spacing:0.04em;color:#94a3b8;"><?php echo esc_html__('Rate', 'fluent-cart'); ?></span>
1169 - <span style="text-align:right;font-size:11px;text-transform:uppercase;letter-spacing:0.04em;color:#94a3b8;white-space:nowrap;"><?php echo esc_html__('Taxable base', 'fluent-cart'); ?></span>
1170 - <span style="text-align:right;font-size:11px;text-transform:uppercase;letter-spacing:0.04em;color:#94a3b8;white-space:nowrap;"><?php echo esc_html__('Tax', 'fluent-cart'); ?></span>
1209 + <div style="display:grid;grid-template-columns:minmax(0,1fr) 92px 64px;column-gap:12px;align-items:start;">
1210 + <span style="min-width:0;font-size:11px;text-transform:uppercase;letter-spacing:0.04em;color:#94a3b8;"><?php echo esc_html__('Rate', 'fluent-cart'); ?></span>
1211 + <span style="text-align:right;font-size:11px;text-transform:uppercase;letter-spacing:0.04em;color:#94a3b8;white-space:nowrap;"><?php echo esc_html__('Taxable base', 'fluent-cart'); ?></span>
1212 + <span style="text-align:right;font-size:11px;text-transform:uppercase;letter-spacing:0.04em;color:#94a3b8;white-space:nowrap;"><?php echo esc_html__('Tax', 'fluent-cart'); ?></span>
1213 + </div>
1214 + <?php foreach ($tyFoldedRateLines as $tyFoldedLine): ?>
1215 + <div class="fct-thank-you-tax-summary-row<?php echo !empty($tyFoldedLine['inclusive']) ? ' fct-thank-you-tax-summary-row--muted' : ''; ?>" style="display:grid;grid-template-columns:minmax(0,1fr) 92px 64px;column-gap:12px;align-items:start;">
1216 + <span style="min-width:0;white-space:normal;overflow-wrap:anywhere;word-break:break-word;"><?php echo esc_html($tyFoldedLine['label']); ?></span>
1217 + <span style="text-align:right;color:#94a3b8;white-space:nowrap;"><?php echo esc_html(Helper::toDecimal($tyFoldedLine['base'])); ?></span>
1218 + <span style="text-align:right;white-space:nowrap;"><?php echo esc_html(Helper::toDecimal($tyFoldedLine['tax'])); ?></span>
1171 1219 </div>
1172 - <?php foreach ($tyFoldedRateLines as $tyFoldedLine): ?>
1173 - <div class="fct-thank-you-tax-summary-row<?php echo !empty($tyFoldedLine['inclusive']) ? ' fct-thank-you-tax-summary-row--muted' : ''; ?>" style="display:grid;grid-template-columns:minmax(0,1fr) 92px 64px;column-gap:12px;align-items:start;">
1174 - <span style="min-width:0;white-space:normal;overflow-wrap:anywhere;word-break:break-word;"><?php echo esc_html($tyFoldedLine['label']); ?></span>
1175 - <span style="text-align:right;color:#94a3b8;white-space:nowrap;"><?php echo esc_html(Helper::toDecimal($tyFoldedLine['base'])); ?></span>
1176 - <span style="text-align:right;white-space:nowrap;"><?php echo esc_html(Helper::toDecimal($tyFoldedLine['tax'])); ?></span>
1177 - </div>
1178 - <?php endforeach; ?>
1220 + <?php endforeach; ?>
1221 + <?php if ($tyIsReverseCharge): ?>
1179 1222 <div class="fct-thank-you-tax-summary-row fct-thank-you-tax-summary-row--total">
1223 + <span><?php echo esc_html__('VAT reversed', 'fluent-cart'); ?></span>
1224 + <span><?php echo esc_html($rcReversedValue); ?></span>
1225 + </div>
1226 + <?php else: ?>
1227 + <div class="fct-thank-you-tax-summary-row fct-thank-you-tax-summary-row--total">
1180 1228 <span><?php echo esc_html__('Total tax', 'fluent-cart'); ?></span>
1181 1229 <span><?php echo esc_html(Helper::toDecimal($tyTotalOrderTax)); ?></span>
1182 1230 </div>
1183 1231 <?php if ($tyIncludedInPrices > 0): ?>
@@ -1191,9 +1239,26 @@
1191 1239 <span><?php echo esc_html__('Payable now (added)', 'fluent-cart'); ?></span>
1192 1240 <span><?php echo esc_html(Helper::toDecimal($tyPayableTax)); ?></span>
1193 1241 </div>
1194 1242 <?php endif; ?>
1195 - <?php else: ?>
1243 + <?php endif; ?>
1244 + <?php elseif ($tyIsReverseCharge): ?>
1245 + <?php if ($summary['showRcShippingRow'] && $rcReversedShipping > 0): ?>
1246 + <div class="fct-thank-you-tax-summary-row fct-thank-you-tax-summary-row--muted">
1247 + <span><?php echo esc_html__('Added on shipping', 'fluent-cart'); ?></span>
1248 + <span style="text-decoration:line-through;opacity:0.6;"><?php echo esc_html(Helper::toDecimal($rcReversedShipping)); ?></span>
1249 + </div>
1250 + <?php endif; ?>
1251 + <div class="fct-thank-you-tax-summary-row fct-thank-you-tax-summary-row--total">
1252 + <span><?php echo esc_html__('Tax reversed', 'fluent-cart'); ?></span>
1253 + <span><?php echo esc_html($rcReversedValue); ?></span>
1254 + </div>
1255 + <?php else: ?>
1256 + <?php
1257 + $tyFeeRows = Arr::get($summary, 'feeTaxLineRows', []);
1258 + $taxRateLines = Arr::get($summary, 'taxRateLines', []);
1259 + $shippingTaxLines = Arr::get($summary, 'shippingTaxLines', []);
1260 + ?>
1196 1261 <?php
1197 1262 $productTaxRowCount = !empty($taxRateLines)
1198 1263 ? count($taxRateLines)
1199 1264 : (int) ($summary['inclusiveTax'] > 0) + (int) ($summary['exclusiveTax'] > 0);
@@ -1266,10 +1331,8 @@
1266 1331 <span><?php echo esc_html(Helper::toDecimal($summary['totalOrderTax'])); ?></span>
1267 1332 </div>
1268 1333 <?php endif; ?>
1269 1334 <?php endif; ?>
1270 - <?php endif; ?>
1271 - </div>
1272 1335 <?php
1273 1336 }
1274 1337
1275 1338 public function renderItemTaxPill($item, $order)