HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/CW-techs/wp-content/themes/cw-techs/page-checkout.php
<?php
/**
 * Template Name: Custom Checkout
 */
get_header();
?>



<section class="checkout-details">
    <div class="container custom-container">
        <div class="back-btn">
            <a href="<?php echo home_url(); ?>" class="back-to-home">
                <span><img src="<?php echo get_template_directory_uri(); ?>/img/arrow1s.svg" alt="arrow1s"></span>
                Back to home
            </a>
        </div>

        <div class="row checkout-inner">
            <!-- Left column -->
            <div class="col-md-12 checkout-details">
                <?php
                if (function_exists('is_checkout') && is_checkout() && !is_order_received_page()) {
                    display_saved_addresses_checkout();
                }
                ?>

                

                <!-- WooCommerce Checkout Form -->
                <div class="card-section woocommerce-section">
                    
                    <?php echo do_shortcode('[woocommerce_checkout]'); ?>
                </div>
            </div>

            <!-- Right column -->
            <!-- <div class="col-lg-4 right-sec">
                <div class="top-sec">
                    <div class="col-sec">
                        <div class="left-ico"><img src="<?php echo get_template_directory_uri(); ?>/img/product-ico.svg" alt="product-ico"></div>
                        <div class="rt-content">
                            <div class="rt-title">4 Products</div>
                            <div class="exp-cont">
                                Expected delivery date: <span class="date">02 June 2025</span>
                            </div>
                        </div>
                    </div>

                    <div class="arrow">
                        <img src="<?php echo get_template_directory_uri(); ?>/img/arrow-rt.svg" alt="arrow">
                    </div>
                </div>

                <div class="cart-rt-sec">
                    <div class="cart-summary">
                        <div class="card-details">
                            <div class="total-amount-txt">Sub Total</div>
                            <div class="total-amount-txt">₹36,796</div>
                        </div>
                        <div class="card-details">
                            <div class="total-amount-txt">Shipping</div>
                            <div class="total-amount-txt">₹100</div>
                        </div>
                        <div class="totl-sec">
                            <div class="totl-amunt">Total Amount</div>
                            <div class="totl-amunt">₹36,896</div>
                        </div>
                    </div>
                    <div class="checkout-sec">
                        <button class="checkout-btn">Proceed to checkout</button>
                    </div>
                </div>
            </div> -->
        </div>
    </div>
</section>
<!-- Success Modal -->
<div class="modal fade success-modal" id="successModal" tabindex="-1" aria-labelledby="successModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered">
    <div class="modal-content">
      <div class="modal-inner">
        <div class="success-icon">
          <img src="<?php echo get_template_directory_uri(); ?>/img/success-icon.svg" alt="success-icon">
        </div>
        <div class="modal-title">Thank you! Your order was placed successfully</div>
        <div class="content">
          Thank you for your purchase. Order details have been sent to your email.
        </div>

        <div class="cart-inner-sec">

          <?php 
          $order_id = absint( get_query_var('order-received') );
          $order = wc_get_order($order_id);
          if ( $order ) :
              foreach ( $order->get_items() as $item_id => $item ) :
                  $product = $item->get_product();
                  $name = $product->get_name();
                  $qty = $item->get_quantity();
                  $price = wc_price( $item->get_total() );
                  $thumbnail = $product->get_image();
                  $sale_price = $product->get_sale_price();
                    $regular_price = $product->get_regular_price();

                    // Fallback if no sale
                    if ( $sale_price && $regular_price > 0 ) {
                        $discount = round( ( ( $regular_price - $sale_price ) / $regular_price ) * 100 );
                    } else {
                        $discount = 0;
                    }
          ?>
          <div class="cart-item">
            <div class="product-inner">
                <div class="product-sec">
                    <div class="product"><?php echo $thumbnail; ?></div>
                </div>
                <div class="product-details">
                    <h5 class="product-name"><?php echo $product->get_name(); ?></h5>
                    <div class="tags">
                        <?php
                        $brand = $product->get_attribute('brand');
                        if (!empty($brand)) :
                        ?>
                            <span class="badge"><?php echo esc_html($brand); ?></span>
                        <?php endif; ?>
                        <span class="badge txt-sec">
                            <span><?php echo wc_price( $sale_price ?: $regular_price ); ?></span>
                            <?php if ( $sale_price && $sale_price < $regular_price ) : ?>
                                <span class="txt"><?php echo wc_price( $regular_price ); ?></span>
                                <span class="txt-col"><?php echo $discount; ?>%</span>
                            <?php endif; ?>
                        </span>
                        <span class="badge">Qty:&nbsp;<span class="current-qty"><?php echo intval($qty); ?></span></span>
                        <?php
                              // Product color and spec
                              $product_color = get_post_meta($product->get_id(), 'product_color', true);
                              $product_spec = get_post_meta($product->get_id(), 'product_specification', true);

                              if (!empty($product_color)) {
                                echo '<span class="badge">' . esc_html($product_color) . '</span>';
                              }

                              if (!empty($product_spec)) {
                                echo '<span class="badge">' . esc_html($product_spec) . '</span>';
                              }
                            ?>
                    </div>
                </div>
            </div>
            <div class="quatity qulity-txt">
            <?php echo $price; ?>
           
          </div>
          </div>
          <?php 
              endforeach;
          endif;
          ?>
        </div>

        <?php if ( $order ) : ?>
            <div class="total-amount">
                <div class="amunt-txt">Grand Total:</div>
                <div class="amunt-txt price-txt"><?php echo wc_price( $order->get_total() ); ?></div>
            </div>
        <?php endif; ?>

        <div class="continue-btn">
          <a href="<?php echo esc_url(get_permalink(wc_get_page_id('shop'))); ?>" class="btn continue-btn1">Continue Shopping</a>
        </div>
      </div>
    </div>
  </div>
</div>

<?php get_footer(); ?>