PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.1
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.1
1.7.1 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 All 51 releases
← All changes | app/Http/Routes/WebRoutes.php +38 -1 1.6.1 → 1.7.1 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()
@@ -282,10 +283,41 @@
282 283 'wp_head' => false,
283 284 'wp_footer' => false,
284 285 ]);
285 286 return true;
286 -
287 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;
319 +
288 320 case 'print-invoice':
289 321 return self::handlePrintRoute('invoice');
290 322
291 323 case 'print-packing-slip':
@@ -336,8 +368,13 @@
336 368 $quantity = 1;
337 369 }
338 370
339 371 $cart = CartResource::generateCartForInstantCheckout($variationId, $quantity);
372 +
373 + // A WP_Error is truthy, so without this it reached the renderer as a cart.
374 + if (is_wp_error($cart)) {
375 + return false;
376 + }
340 377
341 378 if ($cart) {
342 379 $modalCheckoutRenderer = new ModalCheckoutRenderer($cart);
343 380 ob_start();