Review tweaks

This commit is contained in:
Chase Wiseman 2017-11-09 09:26:17 -08:00
parent c7df19f3ab
commit 9558c49e72
3 changed files with 4 additions and 18 deletions

View File

@ -152,7 +152,7 @@ class WC_Payment_Gateways {
foreach ( $this->payment_gateways as $gateway ) {
if ( $gateway->is_available() ) {
if ( ! is_add_payment_method_page() && ! is_payment_methods_page() ) {
if ( ! is_add_payment_method_page() ) {
$_available_gateways[ $gateway->id ] = $gateway;
} elseif ( $gateway->supports( 'add_payment_method' ) || $gateway->supports( 'tokenization' ) ) {
$_available_gateways[ $gateway->id ] = $gateway;

View File

@ -212,22 +212,6 @@ if ( ! function_exists( 'is_order_received_page' ) ) {
}
}
if ( ! function_exists( 'is_payment_methods_page' ) ) {
/**
* Determines if the current page is Payment Methods.
*
* @since 3.3-dev
*
* @return bool
*/
function is_payment_methods_page() {
global $wp;
return ( is_page( wc_get_page_id( 'myaccount' ) ) && isset( $wp->query_vars['payment-methods'] ) );
}
}
if ( ! function_exists( 'is_add_payment_method_page' ) ) {
/**
@ -238,7 +222,7 @@ if ( ! function_exists( 'is_add_payment_method_page' ) ) {
function is_add_payment_method_page() {
global $wp;
return ( is_page( wc_get_page_id( 'myaccount' ) ) && isset( $wp->query_vars['add-payment-method'] ) );
return ( is_page( wc_get_page_id( 'myaccount' ) ) && ( isset( $wp->query_vars['payment-methods'] ) || isset( $wp->query_vars['add-payment-method'] ) ) );
}
}

View File

@ -78,4 +78,6 @@ do_action( 'woocommerce_before_account_payment_methods', $has_methods ); ?>
<?php if ( WC()->payment_gateways->get_available_payment_gateways() ) : ?>
<a class="button" href="<?php echo esc_url( wc_get_endpoint_url( 'add-payment-method' ) ); ?>"><?php esc_html_e( 'Add payment method', 'woocommerce' ); ?></a>
<?php else : ?>
<p class="woocommerce-Message woocommerce-Message--info woocommerce-info"><?php esc_html_e( 'New payment methods cannot be added from the My Account page.', 'woocommerce' ); ?></p>
<?php endif; ?>