Advertisement
nshelper

Untitled

Apr 18th, 2024
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.68 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://woocommerce.com/document/template-structure/
  14. * @package WooCommerce\Templates
  15. * @version 5.2.0
  16. */
  17.  
  18. defined( '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. do_action( 'woocommerce/cart_loop/start', $cart_item );
  33. $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
  34.  
  35. if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_checkout_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
  36. ?>
  37. <tr class="<?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
  38. <td class="product-name">
  39. <?php echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) ) . '&nbsp;'; ?>
  40. <?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 ?>
  41. <?php echo wc_get_formatted_cart_item_data( $cart_item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
  42. </td>
  43. <td class="product-total">
  44. <?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 ?>
  45. </td>
  46. </tr>
  47. <?php
  48. }
  49. do_action( 'woocommerce/cart_loop/end', $cart_item );
  50. }
  51.  
  52. do_action( 'woocommerce_review_order_after_cart_contents' );
  53. ?>
  54. </tbody>
  55. <tfoot>
  56.  
  57. <tr class="cart-subtotal">
  58. <th><?php esc_html_e( 'Subtotal', 'woocommerce' ); ?></th>
  59. <td><?php wc_cart_totals_subtotal_html(); ?></td>
  60. </tr>
  61.  
  62. <?php foreach ( WC()->cart->get_coupons() as $code => $coupon ) : ?>
  63. <tr class="cart-discount coupon-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
  64. <th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
  65. <td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
  66. </tr>
  67. <?php endforeach; ?>
  68.  
  69. <?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
  70.  
  71. <?php do_action( 'woocommerce_review_order_before_shipping' ); ?>
  72.  
  73. <?php wc_cart_totals_shipping_html(); ?>
  74.  
  75. <?php do_action( 'woocommerce_review_order_after_shipping' ); ?>
  76.  
  77. <?php endif; ?>
  78.  
  79. <?php foreach ( WC()->cart->get_fees() as $fee ) : ?>
  80. <tr class="fee">
  81. <th><?php echo esc_html( $fee->name ); ?></th>
  82. <td><?php wc_cart_totals_fee_html( $fee ); ?></td>
  83. </tr>
  84. <?php endforeach; ?>
  85.  
  86. <?php if ( wc_tax_enabled() && ! WC()->cart->display_prices_including_tax() ) : ?>
  87. <?php if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) : ?>
  88. <?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited ?>
  89. <tr class="tax-rate tax-rate-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
  90. <th><?php echo esc_html( $tax->label ); ?></th>
  91. <td><?php echo wp_kses_post( $tax->formatted_amount ); ?></td>
  92. </tr>
  93. <?php endforeach; ?>
  94. <?php else : ?>
  95. <tr class="tax-total">
  96. <th><?php echo esc_html( WC()->countries->tax_or_vat() ); ?></th>
  97. <td><?php wc_cart_totals_taxes_total_html(); ?></td>
  98. </tr>
  99. <?php endif; ?>
  100. <?php endif; ?>
  101.  
  102. <?php do_action( 'woocommerce_review_order_before_order_total' ); ?>
  103.  
  104. <tr class="order-total">
  105. <th><?php esc_html_e( 'Total', 'woocommerce' ); ?></th>
  106. <td><?php wc_cart_totals_order_total_html(); ?></td>
  107. </tr>
  108.  
  109. <?php do_action( 'woocommerce_review_order_after_order_total' ); ?>
  110.  
  111. </tfoot>
  112. </table>
  113.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement