snave07

review-order.php

Oct 13th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.94 KB | None | 0 0
  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. * @author WooThemes
  15. * @package WooCommerce/Templates
  16. * @version 3.3.0
  17. */
  18.  
  19. if ( ! defined( 'ABSPATH' ) ) {
  20. exit;
  21. }
  22.  
  23. $thegem_checkout_type = thegem_get_option('checkout_type', 'multi-step');
  24. ?>
  25. <table class="shop_table woocommerce-checkout-review-order-table">
  26. <thead class="no-responsive">
  27. <tr>
  28. <th class="product-name" <?php if ($thegem_checkout_type == 'multi-step'): ?>colspan="2"<?php endif; ?>><?php _e( 'Product', 'woocommerce' ); ?></th>
  29. <?php if ($thegem_checkout_type == 'multi-step'): ?>
  30. <th class="product-quantity"><?php _e( 'Quantity', 'woocommerce' ); ?></th>
  31. <?php endif; ?>
  32. <th class="product-total"><?php _e( 'Total', 'woocommerce' ); ?></th>
  33. </tr>
  34. </thead>
  35. <tbody class="no-responsive">
  36. <?php
  37. do_action( 'woocommerce_review_order_before_cart_contents' );
  38.  
  39. foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
  40. $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
  41.  
  42. if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_checkout_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
  43. ?>
  44. <tr class="<?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
  45. <?php if ($thegem_checkout_type == 'multi-step'): ?>
  46. <td class="product-thumbnail">
  47. <?php
  48. $thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
  49.  
  50. if ( ! $_product->is_visible() ) {
  51. echo $thumbnail;
  52. } else {
  53. printf( '<a href="%s">%s</a>', esc_url( $_product->get_permalink( $cart_item ) ), $thumbnail );
  54. }
  55. ?>
  56. </td>
  57. <?php endif; ?>
  58. <td class="product-name">
  59. <div class="product-title">
  60. <?php echo apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ); ?>
  61. <span>x <?php echo apply_filters( 'woocommerce_checkout_cart_item_quantity',$cart_item['quantity'], $cart_item, $cart_item_key ); ?></span>
  62. </div>
  63. <div class="product-meta">
  64. <?php echo wc_get_formatted_cart_item_data( $cart_item ); ?>
  65. </div>
  66. </td>
  67. <?php if ($thegem_checkout_type == 'multi-step'): ?>
  68. <td class="product-quantity checkout-product-quantity">
  69. <?php echo apply_filters( 'woocommerce_checkout_cart_item_quantity', ' <div class="center">' . $cart_item['quantity'] . '</div>', $cart_item, $cart_item_key ); ?>
  70. </td>
  71. <?php endif; ?>
  72. <td class="product-total">
  73. <?php echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); ?>
  74. </td>
  75. </tr>
  76. <?php
  77. }
  78. }
  79.  
  80. do_action( 'woocommerce_review_order_after_cart_contents' );
  81. ?>
  82. </tbody>
  83.  
  84. <tbody class="responsive">
  85. <tr><td colspan="<?php if ($thegem_checkout_type == 'multi-step'): ?>4<?php endif; ?><?php if ($thegem_checkout_type == 'one-page'): ?>2<?php endif; ?>">
  86. <table>
  87. <thead>
  88. <tr>
  89. <th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th>
  90. <th class="product-total"><?php _e( 'Total', 'woocommerce' ); ?></th>
  91. </tr>
  92. </thead>
  93. <tbody>
  94. <?php
  95. do_action( 'woocommerce_review_order_before_cart_contents' );
  96.  
  97. foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
  98. $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
  99.  
  100. if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_checkout_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
  101. ?>
  102. <tr class="<?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
  103. <td class="product-name">
  104. <div class="product-title">
  105. <?php echo apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ); ?>
  106. <span>x <?php echo apply_filters( 'woocommerce_checkout_cart_item_quantity',$cart_item['quantity'], $cart_item, $cart_item_key ); ?></span>
  107. </div>
  108. <div class="product-meta">
  109. <?php echo wc_get_formatted_cart_item_data( $cart_item ); ?>
  110. </div>
  111. </td>
  112. <td class="product-total">
  113. <?php echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); ?>
  114. </td>
  115. </tr>
  116. <?php
  117. }
  118. }
  119.  
  120. do_action( 'woocommerce_review_order_after_cart_contents' );
  121. ?>
  122. </tbody>
  123. </table>
  124. </td>
  125.  
  126.  
  127.  
  128. <tfoot>
  129. <tr>
  130. <td class="shop-table-footer-total" colspan="<?php if ($thegem_checkout_type == 'multi-step'): ?>4<?php endif; ?><?php if ($thegem_checkout_type == 'one-page'): ?>2<?php endif; ?>">
  131. <table class="shop_table woocommerce-checkout-payment-total">
  132. <tr class="cart-subtotal">
  133. <th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
  134. <td><?php wc_cart_totals_subtotal_html(); ?></td>
  135. </tr>
  136.  
  137. <?php foreach ( WC()->cart->get_coupons() as $code => $coupon ) : ?>
  138. <tr class="cart-discount coupon-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
  139. <th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
  140. <td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
  141. </tr>
  142. <?php endforeach; ?>
  143.  
  144. <?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
  145.  
  146. <?php do_action( 'woocommerce_review_order_before_shipping' ); ?>
  147.  
  148. <?php wc_cart_totals_shipping_html(); ?>
  149.  
  150. <?php do_action( 'woocommerce_review_order_after_shipping' ); ?>
  151.  
  152. <?php endif; ?>
  153.  
  154. <?php foreach ( WC()->cart->get_fees() as $fee ) : ?>
  155. <tr class="fee">
  156. <th><?php echo esc_html( $fee->name ); ?></th>
  157. <td><?php wc_cart_totals_fee_html( $fee ); ?></td>
  158. </tr>
  159. <?php endforeach; ?>
  160.  
  161. <?php if ( wc_tax_enabled() && ! WC()->cart->display_prices_including_tax() ) : ?>
  162. <?php if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) : ?>
  163. <?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : ?>
  164. <tr class="tax-rate tax-rate-<?php echo sanitize_title( $code ); ?>">
  165. <th><?php echo esc_html( $tax->label ); ?></th>
  166. <td><?php echo wp_kses_post( $tax->formatted_amount ); ?></td>
  167. </tr>
  168. <?php endforeach; ?>
  169. <?php else : ?>
  170. <tr class="tax-total">
  171. <th><?php echo esc_html( WC()->countries->tax_or_vat() ); ?></th>
  172. <td><?php wc_cart_totals_taxes_total_html(); ?></td>
  173. </tr>
  174. <?php endif; ?>
  175. <?php endif; ?>
  176.  
  177. <?php do_action( 'woocommerce_review_order_before_order_total' ); ?>
  178.  
  179. <tr class="order-total">
  180. <th><?php _e( 'Total', 'woocommerce' ); ?></th>
  181. <td><?php wc_cart_totals_order_total_html(); ?></td>
  182. </tr>
  183.  
  184. <?php do_action( 'woocommerce_review_order_after_order_total' ); ?>
  185. </table>
  186. </td>
  187. </tr>
  188. </tfoot>
  189. </table>
Advertisement
Add Comment
Please, Sign In to add comment