PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / trunk
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster vtrunk
2.7.0 2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 All 43 releases
sellkit / includes / block-editor / blocks / checkout / templates / review-order.php

review-order.php in SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster trunk, at includes/block-editor/blocks/checkout/templates/review-order.php

172 lines 6.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 5.2.0
16 */
17
18 defined( 'ABSPATH' ) || exit;
19 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals -- WooCommerce/Elementor template; variables mirror core docs.
20 ?>
21
22 <?php
23 if ( ! function_exists( 'sellkit_checkout_order_hidden_quantity_review_order' ) ) {
24 /**
25 * Hide checkout order product quantity input and show raw quantity.
26 *
27 * @param string $input_html default quantity input.
28 * @param int $quantity product quantity in cart.
29 * @since 2.3.0
30 * @return void
31 *
32 * @SuppressWarnings(PHPMD.UnusedFormalParameter)
33 */
34 function sellkit_checkout_order_hidden_quantity_review_order( $input_html, $quantity ) {
35 $html = $input_html;
36 echo sprintf(
37 /** Translators: %s: product quantity */
38 '<strong class="product-quantity">%s</strong>',
39 esc_html( $quantity )
40 );
41 }
42 }
43
44 if ( isset( $review_order_attributes['disableCartEditing'] ) && $review_order_attributes['disableCartEditing'] ) {
45 add_filter( 'sellkit-checkout-block-disable-quantity', 'sellkit_checkout_order_hidden_quantity_review_order', 10, 2 );
46 }
47 ?>
48 <table class="shop_table woocommerce-checkout-review-order-table" cellspacing="0">
49 <thead>
50 <?php ob_start(); ?>
51 <tr>
52 <th class="product-name"><?php esc_html_e( 'Product', 'sellkit' ); ?></th>
53 <th class="product-total"><?php esc_html_e( 'Subtotal', 'sellkit' ); ?></th>
54 </tr>
55 <?php ob_get_clean(); ?>
56 </thead>
57 <tbody>
58 <?php
59 do_action( 'woocommerce_review_order_before_cart_contents' );
60
61 foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
62 $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
63
64 if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_checkout_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
65 ob_start();
66 ?>
67 <tr class="<?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
68 <td class="product-name">
69 <?php echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) ) . '&nbsp;'; ?>
70 <?php echo apply_filters( 'woocommerce_checkout_cart_item_quantity', ' <strong class="product-quantity">' . sprintf( '&times;&nbsp;%s', $cart_item['quantity'] ) . '</strong>', $cart_item, $cart_item_key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
71 <?php echo wc_get_formatted_cart_item_data( $cart_item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
72 </td>
73 <td class="product-total">
74 <?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 ?>
75 </td>
76 </tr>
77 <?php
78 $row = ob_get_clean();
79
80 do_action( 'sellkit-block-one-page-checkout-custom-order-item', $row, $_product, $cart_item, $cart_item_key );
81 }
82 }
83
84 do_action( 'woocommerce_review_order_after_cart_contents' );
85 do_action( 'sellkit-block-checkout-custom-coupon-form' );
86 ?>
87
88 </tbody>
89
90 <tfoot class="sellkit-checkout-widget-order-summary-tfoot">
91 <tr class="cart-subtotal">
92 <th class="sellkit-checkout-widget-divider"><?php esc_html_e( 'Subtotal', 'sellkit' ); ?></th>
93 <td class="sellkit-checkout-widget-divider"><?php wc_cart_totals_subtotal_html(); ?></td>
94 </tr>
95
96 <?php do_action( 'sellkit-block-checkout-display-shipping-price' ); ?>
97
98 <?php
99 add_filter( 'woocommerce_cart_totals_coupon_label', function( $label, $coupon ) {
100 return sprintf(
101 '%s<span class="sellkit-coupon-label">%s</span>',
102 esc_html__( 'Discount', 'sellkit' ),
103 esc_html( $coupon->get_code() )
104 );
105 }, 10, 2 );
106 ?>
107
108 <?php foreach ( WC()->cart->get_coupons() as $code => $coupon ) : ?>
109 <tr class="cart-discount coupon-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
110 <th>
111 <?php wc_cart_totals_coupon_label( $coupon ); ?>
112 <?php
113 $coupon = new \WC_Coupon( $coupon );
114 $link = esc_url( add_query_arg( 'remove_coupon', urlencode( $coupon->get_code() ), defined( 'WOOCOMMERCE_CHECKOUT' ) ? wc_get_checkout_url() : wc_get_cart_url() ) ); // phpcs:ignore
115 ?>
116 <span
117 class="woocommerce-remove-coupon"
118 data-coupon="<?php echo esc_attr( $code ); ?>"
119 data-link="<?php echo esc_attr( $link ); ?>"
120 >
121 <span class="woo-remove-coupon" title="<?php echo esc_attr__( 'Remove coupon', 'sellkit' ); ?>"></span>
122 </span>
123 </th>
124 <td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
125 </tr>
126 <?php endforeach; ?>
127
128 <?php /* ! shipping method moved. */ ?>
129
130 <?php foreach ( WC()->cart->get_fees() as $fee ) : ?>
131 <tr class="fee">
132 <th><?php echo esc_html( $fee->name ); ?></th>
133 <td><?php wc_cart_totals_fee_html( $fee ); ?></td>
134 </tr>
135 <?php endforeach; ?>
136
137 <?php if ( wc_tax_enabled() && ! WC()->cart->display_prices_including_tax() ) : ?>
138 <?php if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) : ?>
139 <?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : /* phpcs:ignore */ ?>
140 <tr class="tax-rate tax-rate-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
141 <th><?php echo esc_html( $tax->label ); ?></th>
142 <td><?php echo wp_kses_post( $tax->formatted_amount ); ?></td>
143 </tr>
144 <?php endforeach; ?>
145 <?php else : ?>
146 <tr class="tax-total">
147 <th><?php echo esc_html( WC()->countries->tax_or_vat() ); ?></th>
148 <td><?php wc_cart_totals_taxes_total_html(); ?></td>
149 </tr>
150 <?php endif; ?>
151 <?php endif; ?>
152
153 <!-- Discount are hooked here -->
154 <?php do_action( 'woocommerce_review_order_before_order_total' ); ?>
155
156 <tr class="order-total">
157 <th class="sellkit-checkout-widget-divider sellkit-order-total"><?php esc_html_e( 'Total', 'sellkit' ); ?></th>
158 <td class="sellkit-checkout-widget-divider sellkit-order-total"><?php wc_cart_totals_order_total_html(); ?></td>
159 </tr>
160
161 <?php do_action( 'woocommerce_review_order_after_order_total' ); ?>
162 </tfoot>
163 </table>
164 <script>
165 if ( typeof window.sellkitCheckoutMakeSureJsWorks === 'function' ) {
166 window.sellkitCheckoutMakeSureJsWorks();
167 }
168 </script>
169 <?php if ( ! wp_doing_ajax() ) : ?>
170 <?php do_action( 'sellkit-block-checkout-after-order-summary' ); ?>
171 <?php endif; ?>
172