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/Http/Routes/WebRoutes.php +42 -2 1.5.5 → 1.7.0 View file →
@@ -23,8 +23,9 @@
23 23 use FluentCart\App\Vite;
24 24 use FluentCart\Framework\Support\Arr;
25 25 use FluentCart\App\Services\Renderer\CheckoutRenderer;
26 26 use FluentCart\App\Services\Renderer\ModalCheckoutRenderer;
27 +use FluentCart\App\Services\Renderer\OrderReviewRenderer;
27 28
28 29 class WebRoutes
29 30 {
30 31 public static function register()
@@ -29,11 +30,19 @@
29 30 {
30 31 public static function register()
31 32 {
32 33
34 + // Late on init, deliberately. These routes do not merely register — they
35 + // TAKE OVER the request, render a full page and die(). At the default
36 + // priority this callback is queued at plugin-include time, so it runs
37 + // before anything that registers on init from `fluentcart_loaded` (every
38 + // add-on, including FluentCart Pro). A route that renders and dies before
39 + // those listeners exist silently drops whatever they would have rendered
40 + // — which is why the saved-payment-method picker and the save-my-card
41 + // consent box appeared on the checkout page but never in modal checkout.
33 42 add_action('init', function () {
34 43 self::registerRoutes();
35 - });
44 + }, 99);
36 45 }
37 46
38 47 public static function renderModalCheckout() {
39 48 add_action('wp_footer', function () {
@@ -274,9 +283,40 @@
274 283 'wp_head' => false,
275 284 'wp_footer' => false,
276 285 ]);
277 286 return true;
278 -
287 +
288 + case 'order-review':
289 + ob_start();
290 + $orderFound = (new OrderReviewRenderer(
291 + sanitize_text_field($request->get('order_hash', ''))
292 + ))->render();
293 + $orderReview = ob_get_clean();
294 +
295 + // A bad or stale link is a page that does not exist, and
296 + // says so to crawlers as well as people.
297 + if (!$orderFound) {
298 + status_header(404);
299 + }
300 +
301 + // wp_head/wp_footer left on, unlike the receipt: the review
302 + // form's script and stylesheet are enqueued during render()
303 + // and there is nowhere else for them to print. It also lets
304 + // the theme dress a page the customer reaches from an email.
305 + // wp_head/wp_footer forced on. This route renders the whole
306 + // document, so nothing else prints them — and the view's
307 + // is_page() guard would otherwise skip both on a site whose
308 + // front page is static, silently dropping every asset the
309 + // review form (and Pro's photo fields) enqueued.
310 + FrontendView::make(
311 + __('Review Your Order', 'fluent-cart'),
312 + $orderReview,
313 + [
314 + 'wp_head' => true,
315 + 'wp_footer' => true,
316 + ]
317 + );
318 + return true;
279 319
280 320 case 'print-invoice':
281 321 return self::handlePrintRoute('invoice');
282 322