<?php
/**
* Review order table
*
* This template can be overridden by copying it to yourtheme/woocommerce/checkout/review-order.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* @see https://woocommerce.com/document/template-structure/
* @package WooCommerce\Templates
* @version 5.2.0
*/
defined( 'ABSPATH' ) || exit;
$total_order = WC()->cart->total;
$total_sale = 0;
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$product = $cart_item['data'];
if ( $product->is_on_sale() ) {
$total_sale += ( $product->get_regular_price() - $product->get_sale_price() ) * $cart_item['quantity'];
}
}
?>
<div class="woocommerce-checkout-review-order-table">
<?php do_action('custom-freeshiping-bar');?>
<div id="total-header">
<button type="button" id="toggle-cart-items" class="button-toggle-cart">
Order Summary
<i class="fa-solid fa-chevron-down"></i>
</button>
<div class="total-money">
<span class="total-sale">$<?php echo number_format($total_sale, 2); ?></span>
<span class="total-order">$<?php echo number_format($total_order, 2); ?></span>
</div>
</div>
<div id="cart-details">
<div class="title-in-review">
<h3 class="co-h3">PURCHARE SUMMARY</h3>
<?php do_action('custom-freeshiping-bar');?>
</div>
<ul id="cart-items-list" class="woocommerce-mini-cart cart_list product_list_widget">
<?php if ( ! WC()->cart->is_empty() ) : ?>
<?php
do_action( 'woocommerce_review_order_before_cart_contents' );
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_checkout_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
$product_name = apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key );
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
$product_price = apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key );
$product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key );
if ( empty( $product_permalink ) ) {
$product_name = '<span class="nm-cart-panel-product-title">' . wp_kses_post( $product_name ) . '</span>';
} else {
$product_permalink = esc_url( $product_permalink );
$thumbnail = '<a href="' . $product_permalink . '">' . $thumbnail . '</a>';
$product_name = '<a href="' . $product_permalink . '" class="nm-cart-panel-product-title">' . wp_kses_post( $product_name ) . '</a>';
}
$product = wc_get_product($product_id);
?>
<li id="nm-cart-panel-item-<?php echo esc_attr( $cart_item_key ); ?>" class="woocommerce-mini-cart-item <?php echo esc_attr( apply_filters( 'woocommerce_mini_cart_item_class', 'mini_cart_item', $cart_item, $cart_item_key ) ); ?>">
<div class="nm-cart-panel-item-thumbnail">
<div class="nm-cart-item-loader nm-loader"></div>
<div class="nm-cart-panel-thumbnail-wrap">
<?php echo $thumbnail; ?>
<div class="nm-cart-panel-thumbnail-loader nm-loader"></div>
</div>
</div>
<div class="nm-cart-panel-item-details">
<?php echo apply_filters( 'woocommerce_cart_item_remove_link',
sprintf(
'<a href="%s" class="remove remove_from_cart_button" aria-label="%s" data-product_id="%s" data-cart_item_key="%s" data-product_sku="%s"><i class="nm-font nm-font-close2"></i></a>',
esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
esc_attr( sprintf( __( 'Remove %s from cart', 'woocommerce' ), wp_strip_all_tags( $product_name ) ) ),
esc_attr( $product_id ),
esc_attr( $cart_item_key ),
esc_attr( $_product->get_sku() )
), $cart_item_key );
?>
<?php echo $product_name; ?>
<?php echo wc_get_formatted_cart_item_data( $cart_item ); ?>
<div class="nm-cart-panel-quantity-pricing">
<?php if ( $_product->is_sold_individually() ) : ?>
<?php echo apply_filters( 'woocommerce_widget_cart_item_quantity', '<span class="quantity">' . esc_html__( 'Qty', 'woocommerce' ) . ': ' . $cart_item['quantity'] . '</span>', $cart_item, $cart_item_key ); ?>
<?php else: ?>
<div class="product-quantity" data-title="<?php esc_html_e( 'Quantity', 'woocommerce' ); ?>">
<?php
$product_quantity = woocommerce_quantity_input( array(
'input_name' => "cart[{$cart_item_key}][qty]",
'input_value' => $cart_item['quantity'],
'max_value' => $_product->backorders_allowed() ? '' : $_product->get_stock_quantity(),
'min_value' => '1',
'nm_mini_cart_quantity' => true
), $_product, false );
echo apply_filters( 'woocommerce_widget_cart_item_quantity', $product_quantity, $cart_item, $cart_item_key );
?>
</div>
<?php endif; ?>
<div class="nm-cart-panel-item-price">
<?php if ( $price_html = $product->get_price_html() ) : ?>
<span class="price"><?php echo $price_html; ?></span>
<?php endif; ?>
</div>
</div>
</div>
</li>
<?php
}
}
do_action( 'woocommerce_review_order_after_cart_contents' );
?>
<?php else: ?>
<li class="empty">
<i class="nm-font nm-font-close2"></i>
<span><?php esc_html_e( 'No products in the cart.', 'woocommerce' ); ?></span>
</li>
<?php endif; ?>
</ul>
<?php do_action( 'woocommerce_custom_checkout_counpon' ); ?>
<table class="shop_table">
<tfoot>
<tr class="cart-subtotal">
<th><?php esc_html_e( 'Subtotal', 'woocommerce' ); ?></th>
<td><?php wc_cart_totals_subtotal_html(); ?></td>
</tr>
<?php foreach ( WC()->cart->get_coupons() as $code => $coupon ) : ?>
<tr class="cart-discount coupon-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
<th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
<td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
</tr>
<?php endforeach; ?>
<?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
<?php
// Get available shipping methods
$available_methods = WC()->shipping->get_packages()[0]['rates'];
$chosen_methods = WC()->session->get('chosen_shipping_methods');
$chosen_method = !empty($chosen_methods[0]) ? $chosen_methods[0] : '';
// Only display the chosen method
if (!empty($available_methods[$chosen_method])) {
echo '<tr class="shipping">';
echo '<th>' . esc_html__('Shipping', 'woocommerce') . '</th>';
echo '<td data-title="Shipping">' . wp_kses_post($available_methods[$chosen_method]->label . ': ' . wc_price($available_methods[$chosen_method]->cost)) . '</td>';
echo '</tr>';
}
?>
<?php endif; ?>
<?php foreach ( WC()->cart->get_fees() as $fee ) : ?>
<tr class="fee">
<th><?php echo esc_html( $fee->name ); ?></th>
<td><?php wc_cart_totals_fee_html( $fee ); ?></td>
</tr>
<?php endforeach; ?>
<?php if ( wc_tax_enabled() && ! WC()->cart->display_prices_including_tax() ) : ?>
<?php if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) : ?>
<?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : ?>
<tr class="tax-rate tax-rate-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
<th><?php echo esc_html( $tax->label ); ?></th>
<td><?php echo wp_kses_post( $tax->formatted_amount ); ?></td>
</tr>
<?php endforeach; ?>
<?php else : ?>
<tr class="tax-total">
<th><?php echo esc_html( WC()->countries->tax_or_vat() ); ?></th>
<td><?php wc_cart_totals_taxes_total_html(); ?></td>
</tr>
<?php endif; ?>
<?php endif; ?>
<?php do_action( 'woocommerce_review_order_before_order_total' ); ?>
<tr class="order-total">
<th><?php esc_html_e( 'Total', 'woocommerce' ); ?></th>
<td><?php wc_cart_totals_order_total_html(); ?></td>
</tr>
<?php do_action( 'woocommerce_review_order_after_order_total' ); ?>
</tfoot>
</table>
</div>
</div>