dashboard.php
5 years ago
downloads.php
5 years ago
form-add-payment-method.php
5 years ago
form-edit-account.php
5 years ago
form-edit-address.php
5 years ago
form-login.php
3 years ago
form-lost-password.php
5 years ago
form-reset-password.php
5 years ago
lost-password-confirmation.php
5 years ago
my-account.php
5 years ago
my-address.php
5 years ago
my-downloads.php
5 years ago
my-orders.php
5 years ago
navigation.php
5 years ago
orders.php
5 years ago
payment-methods.php
5 years ago
view-order.php
5 years ago
payment-methods.php
79 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Payment methods |
| 4 | * |
| 5 | * Shows customer payment methods on the account page. |
| 6 | * |
| 7 | * This template can be overridden by copying it to yourtheme/woocommerce/myaccount/payment-methods.php. |
| 8 | * |
| 9 | * HOWEVER, on occasion WooCommerce will need to update template files and you |
| 10 | * (the theme developer) will need to copy the new files to your theme to |
| 11 | * maintain compatibility. We try to do this as little as possible, but it does |
| 12 | * happen. When this occurs the version of the template file will be bumped and |
| 13 | * the readme will list any important changes. |
| 14 | * |
| 15 | * @see https://docs.woocommerce.com/document/template-structure/ |
| 16 | * @package WooCommerce\Templates |
| 17 | * @version 2.6.0 |
| 18 | */ |
| 19 | |
| 20 | defined( 'ABSPATH' ) || exit; |
| 21 | |
| 22 | $saved_methods = wc_get_customer_saved_methods_list( get_current_user_id() ); |
| 23 | $has_methods = (bool) $saved_methods; |
| 24 | $types = wc_get_account_payment_methods_types(); |
| 25 | |
| 26 | do_action( 'woocommerce_before_account_payment_methods', $has_methods ); ?> |
| 27 | |
| 28 | <?php if ( $has_methods ) : ?> |
| 29 | |
| 30 | <table class="woocommerce-MyAccount-paymentMethods shop_table shop_table_responsive account-payment-methods-table"> |
| 31 | <thead> |
| 32 | <tr> |
| 33 | <?php foreach ( wc_get_account_payment_methods_columns() as $column_id => $column_name ) : ?> |
| 34 | <th class="woocommerce-PaymentMethod woocommerce-PaymentMethod--<?php echo esc_attr( $column_id ); ?> payment-method-<?php echo esc_attr( $column_id ); ?>"><span class="nobr"><?php echo esc_html( $column_name ); ?></span></th> |
| 35 | <?php endforeach; ?> |
| 36 | </tr> |
| 37 | </thead> |
| 38 | <?php foreach ( $saved_methods as $type => $methods ) : // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited ?> |
| 39 | <?php foreach ( $methods as $method ) : ?> |
| 40 | <tr class="payment-method<?php echo ! empty( $method['is_default'] ) ? ' default-payment-method' : ''; ?>"> |
| 41 | <?php foreach ( wc_get_account_payment_methods_columns() as $column_id => $column_name ) : ?> |
| 42 | <td class="woocommerce-PaymentMethod woocommerce-PaymentMethod--<?php echo esc_attr( $column_id ); ?> payment-method-<?php echo esc_attr( $column_id ); ?>" data-title="<?php echo esc_attr( $column_name ); ?>"> |
| 43 | <?php |
| 44 | if ( has_action( 'woocommerce_account_payment_methods_column_' . $column_id ) ) { |
| 45 | do_action( 'woocommerce_account_payment_methods_column_' . $column_id, $method ); |
| 46 | } elseif ( 'method' === $column_id ) { |
| 47 | if ( ! empty( $method['method']['last4'] ) ) { |
| 48 | /* translators: 1: credit card type 2: last 4 digits */ |
| 49 | echo sprintf( esc_html__( '%1$s ending in %2$s', 'woocommerce' ), esc_html( wc_get_credit_card_type_label( $method['method']['brand'] ) ), esc_html( $method['method']['last4'] ) ); |
| 50 | } else { |
| 51 | echo esc_html( wc_get_credit_card_type_label( $method['method']['brand'] ) ); |
| 52 | } |
| 53 | } elseif ( 'expires' === $column_id ) { |
| 54 | echo esc_html( $method['expires'] ); |
| 55 | } elseif ( 'actions' === $column_id ) { |
| 56 | foreach ( $method['actions'] as $key => $action ) { // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
| 57 | echo '<a href="' . esc_url( $action['url'] ) . '" class="button ' . sanitize_html_class( $key ) . '">' . esc_html( $action['name'] ) . '</a> '; |
| 58 | } |
| 59 | } |
| 60 | ?> |
| 61 | </td> |
| 62 | <?php endforeach; ?> |
| 63 | </tr> |
| 64 | <?php endforeach; ?> |
| 65 | <?php endforeach; ?> |
| 66 | </table> |
| 67 | |
| 68 | <?php else : ?> |
| 69 | |
| 70 | <p class="woocommerce-Message woocommerce-Message--info woocommerce-info"><?php esc_html_e( 'No saved methods found.', 'woocommerce' ); ?></p> |
| 71 | |
| 72 | <?php endif; ?> |
| 73 | |
| 74 | <?php do_action( 'woocommerce_after_account_payment_methods', $has_methods ); ?> |
| 75 | |
| 76 | <?php if ( WC()->payment_gateways->get_available_payment_gateways() ) : ?> |
| 77 | <a class="button" href="<?php echo esc_url( wc_get_endpoint_url( 'add-payment-method' ) ); ?>"><?php esc_html_e( 'Add payment method', 'woocommerce' ); ?></a> |
| 78 | <?php endif; ?> |
| 79 |