説明なし

review-order.php 4.4KB

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