<?php
defined('ABSPATH') || exit;

$checkout = WC()->checkout();

do_action('woocommerce_before_checkout_form', $checkout);

if (!$checkout || !is_checkout()) {
  return;
}

if (WC()->cart && WC()->cart->is_empty()) {
  echo '<section class="fjord-checkout-page"><div class="fjord-cart-empty"><p>' . esc_html__('Your cart is currently empty.', 'woocommerce') . '</p></div></section>';
  return;
}
?>

<section class="fjord-checkout-page">
  <section class="fjord-shop__intro">
    <h1 class="fjord-shop__title"><?php esc_html_e('Finalizar compra', 'fjord-clone'); ?></h1>
    <p class="fjord-shop__lead"><?php esc_html_e('Completa tus datos para finalizar la compra.', 'fjord-clone'); ?></p>
  </section>

  <form name="checkout" method="post" class="checkout woocommerce-checkout fjord-checkout-grid" action="<?php echo esc_url(wc_get_checkout_url()); ?>" enctype="multipart/form-data">
    <div class="fjord-checkout-panel fjord-checkout-panel--details">
      <div id="customer_details" class="fjord-checkout-columns">
        <div class="fjord-checkout-column fjord-checkout-column--billing">
          <?php do_action('woocommerce_checkout_billing'); ?>
        </div>

        <div class="fjord-checkout-column fjord-checkout-column--shipping">
          <?php do_action('woocommerce_checkout_shipping'); ?>
        </div>
      </div>
    </div>

    <aside class="fjord-checkout-panel fjord-checkout-panel--summary">
      <div id="order_review" class="woocommerce-checkout-review-order">
        <?php do_action('woocommerce_checkout_order_review'); ?>
      </div>
    </aside>
  </form>
</section>

<?php do_action('woocommerce_after_checkout_form', $checkout); ?>
