| 1 |
<?php |
| 2 |
/** |
| 3 |
* Checkout template |
| 4 |
* |
| 5 |
* @package |
| 6 |
*/ |
| 7 |
?> |
| 8 |
<div id="wpfunnels-checkout-form" class="wpfunnels-checkout-form"> |
| 9 |
<?php |
| 10 |
if ( WC()->cart && WC()->cart->is_empty() ) { |
| 11 |
// WC shortcode redirects to cart when empty — bypass it and render the |
| 12 |
// checkout form template directly so the design is visible without products. |
| 13 |
// Set a session flag so the woocommerce_checkout_update_order_review_expired |
| 14 |
// filter can suppress the "session expired" AJAX response for this session. |
| 15 |
wc_clear_notices(); |
| 16 |
WC()->session->set( 'wpfnl_checkout_preview_mode', true ); |
| 17 |
ob_start(); |
| 18 |
wc_get_template( 'checkout/form-checkout.php', array( 'checkout' => WC()->checkout() ) ); |
| 19 |
echo ob_get_clean(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 20 |
} else { |
| 21 |
$checkout_html = do_shortcode( '[woocommerce_checkout]' ); |
| 22 |
if ( empty( $checkout_html ) || trim( $checkout_html ) === '<div class="woocommerce"></div>' ) { |
| 23 |
echo esc_html__( 'Your cart is currently empty.', 'wpfnl' ); |
| 24 |
} else { |
| 25 |
echo $checkout_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 26 |
} |
| 27 |
} |
| 28 |
?> |
| 29 |
</div> |
| 30 |
|