2013-11-01 17:10:24 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2015-11-03 13:53:50 +00:00
|
|
|
* Add payment method form form
|
2013-11-01 17:10:24 +00:00
|
|
|
*
|
2015-11-03 13:31:20 +00:00
|
|
|
* This template can be overridden by copying it to yourtheme/woocommerce/myaccount/form-add-payment-method.php.
|
2015-10-01 14:07:20 +00:00
|
|
|
*
|
2016-02-12 11:28:41 +00:00
|
|
|
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
|
|
|
* (the theme developer) will need to copy the new files to your theme to
|
|
|
|
* maintain compatibility. We try to do this as little as possible, but it does
|
|
|
|
* happen. When this occurs the version of the template file will be bumped and
|
|
|
|
* the readme will list any important changes.
|
2015-10-01 14:07:20 +00:00
|
|
|
*
|
2016-07-19 10:30:31 +00:00
|
|
|
* @see https://docs.woocommerce.com/document/template-structure/
|
2016-01-15 20:34:37 +00:00
|
|
|
* @author WooThemes
|
|
|
|
* @package WooCommerce/Templates
|
2017-11-07 10:03:42 +00:00
|
|
|
* @version 3.3.0
|
2013-11-01 17:10:24 +00:00
|
|
|
*/
|
|
|
|
|
2014-04-23 10:35:43 +00:00
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
2016-01-20 10:47:33 +00:00
|
|
|
exit;
|
2014-04-23 10:35:43 +00:00
|
|
|
}
|
2014-09-22 16:31:03 +00:00
|
|
|
|
2016-06-06 11:05:37 +00:00
|
|
|
if ( $available_gateways = WC()->payment_gateways->get_available_payment_gateways() ) : ?>
|
|
|
|
<form id="add_payment_method" method="post">
|
|
|
|
<div id="payment" class="woocommerce-Payment">
|
|
|
|
<ul class="woocommerce-PaymentMethods payment_methods methods">
|
|
|
|
<?php
|
2017-08-07 11:39:08 +00:00
|
|
|
// Chosen Method.
|
|
|
|
if ( count( $available_gateways ) ) {
|
|
|
|
current( $available_gateways )->set_current();
|
|
|
|
}
|
2013-11-01 17:10:24 +00:00
|
|
|
|
2017-08-07 11:39:08 +00:00
|
|
|
foreach ( $available_gateways as $gateway ) {
|
|
|
|
?>
|
2017-11-07 10:03:42 +00:00
|
|
|
<li class="woocommerce-PaymentMethod woocommerce-PaymentMethod--<?php echo esc_attr( $gateway->id ); ?> payment_method_<?php echo esc_attr( $gateway->id ); ?>">
|
2017-08-07 11:39:08 +00:00
|
|
|
<input id="payment_method_<?php echo esc_attr( $gateway->id ); ?>" type="radio" class="input-radio" name="payment_method" value="<?php echo esc_attr( $gateway->id ); ?>" <?php checked( $gateway->chosen, true ); ?> />
|
|
|
|
<label for="payment_method_<?php echo esc_attr( $gateway->id ); ?>"><?php echo wp_kses_post( $gateway->get_title() ); ?> <?php echo wp_kses_post( $gateway->get_icon() ); ?></label>
|
2016-06-06 11:05:37 +00:00
|
|
|
<?php
|
2017-08-07 11:39:08 +00:00
|
|
|
if ( $gateway->has_fields() || $gateway->get_description() ) {
|
|
|
|
echo '<div class="woocommerce-PaymentBox woocommerce-PaymentBox--' . esc_attr( $gateway->id ) . ' payment_box payment_method_' . esc_attr( $gateway->id ) . '" style="display: none;">';
|
|
|
|
$gateway->payment_fields();
|
|
|
|
echo '</div>';
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</li>
|
|
|
|
<?php
|
|
|
|
}
|
2016-06-06 11:05:37 +00:00
|
|
|
?>
|
|
|
|
</ul>
|
2016-01-20 20:13:17 +00:00
|
|
|
|
2016-06-06 11:05:37 +00:00
|
|
|
<div class="form-row">
|
|
|
|
<?php wp_nonce_field( 'woocommerce-add-payment-method' ); ?>
|
2017-11-07 10:05:29 +00:00
|
|
|
<button type="submit" class="woocommerce-Button woocommerce-Button--alt button alt" id="place_order" value="<?php esc_attr_e( 'Add payment method', 'woocommerce' ); ?>"><?php esc_html_e( 'Add payment method', 'woocommerce' ); ?></button>
|
2016-06-06 11:05:37 +00:00
|
|
|
<input type="hidden" name="woocommerce_add_payment_method" id="woocommerce_add_payment_method" value="1" />
|
2016-01-20 10:47:33 +00:00
|
|
|
</div>
|
2016-06-06 11:05:37 +00:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<?php endif; ?>
|