form-pay.php 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /**
  3. * Pay for order form
  4. *
  5. * This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-pay.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 3.4.0
  16. */
  17. defined( 'ABSPATH' ) || exit;
  18. $totals = $order->get_order_item_totals();
  19. ?>
  20. <form id="order_review" method="post">
  21. <table class="shop_table">
  22. <thead>
  23. <tr>
  24. <th class="product-name"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
  25. <th class="product-quantity"><?php esc_html_e( 'Qty', 'woocommerce' ); ?></th>
  26. <th class="product-total"><?php esc_html_e( 'Totals', 'woocommerce' ); ?></th>
  27. </tr>
  28. </thead>
  29. <tbody>
  30. <?php if ( count( $order->get_items() ) > 0 ) : ?>
  31. <?php foreach ( $order->get_items() as $item_id => $item ) : ?>
  32. <?php
  33. if ( ! apply_filters( 'woocommerce_order_item_visible', true, $item ) ) {
  34. continue;
  35. }
  36. ?>
  37. <tr class="<?php echo esc_attr( apply_filters( 'woocommerce_order_item_class', 'order_item', $item, $order ) ); ?>">
  38. <td class="product-name">
  39. <?php
  40. echo apply_filters( 'woocommerce_order_item_name', esc_html( $item->get_name() ), $item, false ); // @codingStandardsIgnoreLine
  41. do_action( 'woocommerce_order_item_meta_start', $item_id, $item, $order, false );
  42. wc_display_item_meta( $item );
  43. do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order, false );
  44. ?>
  45. </td>
  46. <td class="product-quantity"><?php echo apply_filters( 'woocommerce_order_item_quantity_html', ' <strong class="product-quantity">' . sprintf( '&times; %s', esc_html( $item->get_quantity() ) ) . '</strong>', $item ); ?></td><?php // @codingStandardsIgnoreLine ?>
  47. <td class="product-subtotal"><?php echo $order->get_formatted_line_subtotal( $item ); ?></td><?php // @codingStandardsIgnoreLine ?>
  48. </tr>
  49. <?php endforeach; ?>
  50. <?php endif; ?>
  51. </tbody>
  52. <tfoot>
  53. <?php if ( $totals ) : ?>
  54. <?php foreach ( $totals as $total ) : ?>
  55. <tr>
  56. <th scope="row" colspan="2"><?php echo $total['label']; ?></th><?php // @codingStandardsIgnoreLine ?>
  57. <td class="product-total"><?php echo $total['value']; ?></td><?php // @codingStandardsIgnoreLine ?>
  58. </tr>
  59. <?php endforeach; ?>
  60. <?php endif; ?>
  61. </tfoot>
  62. </table>
  63. <div id="payment">
  64. <?php if ( $order->needs_payment() ) : ?>
  65. <ul class="wc_payment_methods payment_methods methods">
  66. <?php
  67. if ( ! empty( $available_gateways ) ) {
  68. foreach ( $available_gateways as $gateway ) {
  69. wc_get_template( 'checkout/payment-method.php', array( 'gateway' => $gateway ) );
  70. }
  71. } else {
  72. echo '<li class="woocommerce-notice woocommerce-notice--info woocommerce-info">' . apply_filters( 'woocommerce_no_available_payment_methods_message', __( 'Sorry, it seems that there are no available payment methods for your location. Please contact us if you require assistance or wish to make alternate arrangements.', 'woocommerce' ) ) . '</li>'; // @codingStandardsIgnoreLine
  73. }
  74. ?>
  75. </ul>
  76. <?php endif; ?>
  77. <div class="form-row">
  78. <input type="hidden" name="woocommerce_pay" value="1" />
  79. <?php wc_get_template( 'checkout/terms.php' ); ?>
  80. <?php do_action( 'woocommerce_pay_order_before_submit' ); ?>
  81. <?php echo apply_filters( 'woocommerce_pay_order_button_html', '<button type="submit" class="button alt" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '">' . esc_html( $order_button_text ) . '</button>' ); // @codingStandardsIgnoreLine ?>
  82. <?php do_action( 'woocommerce_pay_order_after_submit' ); ?>
  83. <?php wp_nonce_field( 'woocommerce-pay', 'woocommerce-pay-nonce' ); ?>
  84. </div>
  85. </div>
  86. </form>