Skip to content

Commit

Permalink
[2.6] Hide 'payment methods' screen if no methods support it, closes w…
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiosanches committed Jun 14, 2016
1 parent 5ff18eb commit ce96d63
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions includes/wc-account-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,19 @@ function wc_get_account_menu_items() {
unset( $items['downloads'] );
}

// Check if payment gateways support add new payment methods.
$support_payment_methods = false;
foreach ( WC()->payment_gateways->get_available_payment_gateways() as $gateway ) {
if ( $gateway->supports( 'add_payment_method' ) || $gateway->supports( 'tokenization' ) ) {
$support_payment_methods = true;
break;
}
}

if ( ! $support_payment_methods ) {
unset( $items['payment-methods'] );
}

return apply_filters( 'woocommerce_account_menu_items', $items );
}

Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Fix - Missing localized format for line taxes in orders screen.
* Fix - Hour and time fields pattern on the orders screen.
* Fix - PayPal does not allow free products, but paid shipping. Workaround by sending shipping as a line item if it is the only cost.
* Tweak - Hide 'payment methods' screen if no methods support it.

= 2.6.0 - 14/06/16 =
* Feature - Introduced Shipping Zone functionality, and re-usable instance based shipping methods.
Expand Down

0 comments on commit ce96d63

Please sign in to comment.