cart order

Solutions on MaxInterview for cart order by the best coders in the world

showing results for - "cart order"
Emma
16 Oct 2019
1<?php
2/**
3 * Review order table
4 *
5 * This template can be overridden by copying it to yourtheme/woocommerce/checkout/review-order.php.
6 *
7 * HOWEVER, on occasion WooCommerce will need to update template files and you
8 * (the theme developer) will need to copy the new files to your theme to
9 * maintain compatibility. We try to do this as little as possible, but it does
10 * happen. When this occurs the version of the template file will be bumped and
11 * the readme will list any important changes.
12 *
13 * @see https://docs.woocommerce.com/document/template-structure/
14 * @package WooCommerce\Templates
15 * @version 3.8.0
16 */
17
18defined( 'ABSPATH' ) || exit;
19?>
20<table class="shop_table woocommerce-checkout-review-order-table">
21	<thead>
22		<tr>
23			<th class="product-name"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
24			<th class="product-total"><?php esc_html_e( 'Subtotal', 'woocommerce' ); ?></th>
25		</tr>
26	</thead>
27	<tbody>
28		<?php
29		do_action( 'woocommerce_review_order_before_cart_contents' );
30
31		foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
32			$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
33
34			if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_checkout_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
35				?>
36				<tr class="<?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
37					<td class="product-name">
38						<?php echo apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) . ' '; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
39						<?php echo apply_filters( 'woocommerce_checkout_cart_item_quantity', ' <strong class="product-quantity">' . sprintf( '× %s', $cart_item['quantity'] ) . '</strong>', $cart_item, $cart_item_key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
40						<?php echo wc_get_formatted_cart_item_data( $cart_item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
41					</td>
42					<td class="product-total">
43						<?php echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
44					</td>
45				</tr>
46				<?php
47			}
48		}
49
50		do_action( 'woocommerce_review_order_after_cart_contents' );
51		?>
52	</tbody>
53	<tfoot>
54
55		<tr class="cart-subtotal">
56			<th><?php esc_html_e( 'Subtotal', 'woocommerce' ); ?></th>
57			<td><?php wc_cart_totals_subtotal_html(); ?></td>
58		</tr>
59
60		<?php foreach ( WC()->cart->get_coupons() as $code => $coupon ) : ?>
61			<tr class="cart-discount coupon-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
62				<th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
63				<td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
64			</tr>
65		<?php endforeach; ?>
66
67		<?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
68
69			<?php do_action( 'woocommerce_review_order_before_shipping' ); ?>
70
71			<?php wc_cart_totals_shipping_html(); ?>
72
73			<?php do_action( 'woocommerce_review_order_after_shipping' ); ?>
74
75		<?php endif; ?>
76
77		<?php foreach ( WC()->cart->get_fees() as $fee ) : ?>
78			<tr class="fee">
79				<th><?php echo esc_html( $fee->name ); ?></th>
80				<td><?php wc_cart_totals_fee_html( $fee ); ?></td>
81			</tr>
82		<?php endforeach; ?>
83
84		<?php if ( wc_tax_enabled() && ! WC()->cart->display_prices_including_tax() ) : ?>
85			<?php if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) : ?>
86				<?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited ?>
87					<tr class="tax-rate tax-rate-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
88						<th><?php echo esc_html( $tax->label ); ?></th>
89						<td><?php echo wp_kses_post( $tax->formatted_amount ); ?></td>
90					</tr>
91				<?php endforeach; ?>
92			<?php else : ?>
93				<tr class="tax-total">
94					<th><?php echo esc_html( WC()->countries->tax_or_vat() ); ?></th>
95					<td><?php wc_cart_totals_taxes_total_html(); ?></td>
96				</tr>
97			<?php endif; ?>
98		<?php endif; ?>
99
100		<?php do_action( 'woocommerce_review_order_before_order_total' ); ?>
101
102		<tr class="order-total">
103			<th><?php esc_html_e( 'Total', 'woocommerce' ); ?></th>
104			<td><?php wc_cart_totals_order_total_html(); ?></td>
105		</tr>
106
107		<?php do_action( 'woocommerce_review_order_after_order_total' ); ?>
108
109	</tfoot>
110</table>
111
queries leading to this page
order cartcart order