payment.php
77 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Checkout Payment Section |
| 4 | * |
| 5 | * This template can be overridden by copying it to yourtheme/woocommerce/checkout/payment.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 7.0.1 |
| 16 | */ |
| 17 | |
| 18 | use WooCommerce\Square\Plugin; |
| 19 | |
| 20 | defined( 'ABSPATH' ) || exit; |
| 21 | |
| 22 | if ( ! wp_doing_ajax() ) { |
| 23 | // PHPCS ignored as it is a Woo core hook. |
| 24 | do_action( 'woocommerce_review_order_before_payment' ); // phpcs:ignore |
| 25 | } |
| 26 | ?> |
| 27 | |
| 28 | <div id="payment" class="woocommerce-checkout-payment"> |
| 29 | <?php if ( WC()->cart->needs_payment() && ( $is_error || ! $has_balance ) ) : ?> |
| 30 | <ul class="wc_payment_methods payment_methods methods"> |
| 31 | <?php |
| 32 | if ( ! empty( $available_gateways ) ) { |
| 33 | $plugin_gateways = wc_square()->get_gateway_ids(); |
| 34 | foreach ( $available_gateways as $gateway ) { |
| 35 | if ( ! $has_balance && ! in_array( $gateway->id, $plugin_gateways, true ) ) { |
| 36 | continue; |
| 37 | } |
| 38 | wc_get_template( 'checkout/payment-method.php', array( 'gateway' => $gateway ) ); |
| 39 | } |
| 40 | } else { |
| 41 | echo '<li class="woocommerce-notice woocommerce-notice--info woocommerce-info">' . apply_filters( 'woocommerce_no_available_payment_methods_message', WC()->customer->get_billing_country() ? esc_html__( 'Sorry, it seems that there are no available payment methods for your state. Please contact us if you require assistance or wish to make alternate arrangements.', 'woocommerce-square' ) : esc_html__( 'Please fill in your details above to see available payment methods.', 'woocommerce-square' ) ) . '</li>'; // @codingStandardsIgnoreLine |
| 42 | } |
| 43 | ?> |
| 44 | </ul> |
| 45 | <?php endif; ?> |
| 46 | <div class="form-row place-order"> |
| 47 | <noscript> |
| 48 | <?php |
| 49 | /* translators: $1 and $2 opening and closing emphasis tags respectively */ |
| 50 | printf( esc_html__( 'Since your browser does not support JavaScript, or it is disabled, please ensure you click the %1$sUpdate Totals%2$s button before placing your order. You may be charged more than the amount stated above if you fail to do so.', 'woocommerce-square' ), '<em>', '</em>' ); |
| 51 | ?> |
| 52 | <br/><button type="submit" class="button alt<?php echo esc_attr( wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '' ); ?>" name="woocommerce_checkout_update_totals" value="<?php esc_attr_e( 'Update totals', 'woocommerce-square' ); ?>"><?php esc_html_e( 'Update totals', 'woocommerce-square' ); ?></button> |
| 53 | </noscript> |
| 54 | |
| 55 | <?php wc_get_template( 'checkout/terms.php' ); ?> |
| 56 | |
| 57 | <?php |
| 58 | // PHPCS ignored as it is a Woo core hook. |
| 59 | do_action( 'woocommerce_review_order_before_submit' ); // phpcs:ignore |
| 60 | ?> |
| 61 | |
| 62 | <?php echo apply_filters( 'woocommerce_order_button_html', '<button type="submit" class="button alt' . esc_attr( wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '' ) . '" name="woocommerce_checkout_place_order" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '">' . esc_html( $order_button_text ) . '</button>' ); // @codingStandardsIgnoreLine ?> |
| 63 | |
| 64 | <?php |
| 65 | // PHPCS ignored as it is a Woo core hook. |
| 66 | do_action( 'woocommerce_review_order_after_submit' ); // phpcs:ignore |
| 67 | ?> |
| 68 | |
| 69 | <?php wp_nonce_field( 'woocommerce-process_checkout', 'woocommerce-process-checkout-nonce' ); ?> |
| 70 | </div> |
| 71 | </div> |
| 72 | <?php |
| 73 | if ( ! wp_doing_ajax() ) { |
| 74 | // PHPCS ignored as it is a Woo core hook. |
| 75 | do_action( 'woocommerce_review_order_after_payment' ); // phpcs:ignore |
| 76 | } |
| 77 |