review-order.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. if ( ! defined( 'ABSPATH' ) ) {
  19. exit;
  20. }
  21. ?>
  22. <table class="shop_table woocommerce-checkout-review-order-table">
  23. <thead>
  24. <tr>
  25. <th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th>
  26. <th class="product-total"><?php _e( 'Total', 'woocommerce' ); ?></th>
  27. </tr>
  28. </thead>
  29. <tbody>
  30. <?php
  31. do_action( 'woocommerce_review_order_before_cart_contents' );
  32. foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
  33. $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
  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 ) . '&nbsp;'; ?>
  39. <?php echo apply_filters( 'woocommerce_checkout_cart_item_quantity', ' <strong class="product-quantity">' . sprintf( '&times; %s', $cart_item['quantity'] ) . '</strong>', $cart_item, $cart_item_key ); ?>
  40. <?php echo wc_get_formatted_cart_item_data( $cart_item ); ?>
  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 ); ?>
  44. </td>
  45. </tr>
  46. <?php
  47. }
  48. }
  49. do_action( 'woocommerce_review_order_after_cart_contents' );
  50. ?>
  51. </tbody>
  52. <tfoot>
  53. <tr class="cart-subtotal">
  54. <th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
  55. <td><?php wc_cart_totals_subtotal_html(); ?></td>
  56. </tr>
  57. <?php foreach ( WC()->cart->get_coupons() as $code => $coupon ) : ?>
  58. <tr class="cart-discount coupon-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
  59. <th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
  60. <td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
  61. </tr>
  62. <?php endforeach; ?>
  63. <?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
  64. <?php do_action( 'woocommerce_review_order_before_shipping' ); ?>
  65. <?php wc_cart_totals_shipping_html(); ?>
  66. <?php do_action( 'woocommerce_review_order_after_shipping' ); ?>
  67. <?php endif; ?>
  68. <?php foreach ( WC()->cart->get_fees() as $fee ) : ?>
  69. <tr class="fee">
  70. <th><?php echo esc_html( $fee->name ); ?></th>
  71. <td><?php wc_cart_totals_fee_html( $fee ); ?></td>
  72. </tr>
  73. <?php endforeach; ?>
  74. <?php if ( wc_tax_enabled() && ! WC()->cart->display_prices_including_tax() ) : ?>
  75. <?php if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) : ?>
  76. <?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : ?>
  77. <tr class="tax-rate tax-rate-<?php echo sanitize_title( $code ); ?>">
  78. <th><?php echo esc_html( $tax->label ); ?></th>
  79. <td><?php echo wp_kses_post( $tax->formatted_amount ); ?></td>
  80. </tr>
  81. <?php endforeach; ?>
  82. <?php else : ?>
  83. <tr class="tax-total">
  84. <th><?php echo esc_html( WC()->countries->tax_or_vat() ); ?></th>
  85. <td><?php wc_cart_totals_taxes_total_html(); ?></td>
  86. </tr>
  87. <?php endif; ?>
  88. <?php endif; ?>
  89. <?php do_action( 'woocommerce_review_order_before_order_total' ); ?>
  90. <tr class="order-total">
  91. <th><?php _e( 'Total', 'woocommerce' ); ?></th>
  92. <td><?php wc_cart_totals_order_total_html(); ?></td>
  93. </tr>
  94. <?php do_action( 'woocommerce_review_order_after_order_total' ); ?>
  95. </tfoot>
  96. </table>