Skip to content

Commit

Permalink
Fix my account not able to add payment method
Browse files Browse the repository at this point in the history
  • Loading branch information
roykho committed Mar 17, 2017
1 parent df51f4c commit d1c9a7d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
13 changes: 12 additions & 1 deletion includes/class-wc-gateway-stripe.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,17 @@ public function __construct() {

if ( $this->stripe_checkout ) {
$this->order_button_text = __( 'Continue to payment', 'woocommerce-gateway-stripe' );

// Stripe checkout does not support add payment method.
if ( is_add_payment_method_page() ) {
if ( false !== ( $key = array_search( 'add_payment_method', $this->supports ) ) ) {
unset( $this->supports[ $key ] );
}

if ( false !== ( $key = array_search( 'tokenization', $this->supports ) ) ) {
unset( $this->supports[ $key ] );
}
}
}

if ( $this->testmode ) {
Expand Down Expand Up @@ -524,7 +535,7 @@ public function admin_scripts() {
* @access public
*/
public function payment_scripts() {
if ( ! is_cart() && ! is_checkout() && ! isset( $_GET['pay_for_order'] ) ) {
if ( ! is_cart() && ! is_checkout() && ! isset( $_GET['pay_for_order'] ) && ! is_add_payment_method_page() ) {
return;
}

Expand Down
10 changes: 6 additions & 4 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: automattic, woothemes, mikejolley, akeda, royho, mattyza, slash1an
Tags: credit card, stripe, woocommerce
Requires at least: 4.4
Tested up to: 4.7.2
Stable tag: 3.1.1
Stable tag: 3.1.2
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -95,6 +95,9 @@ If you get stuck, you can ask for help in the Plugin Forum.

== Changelog ==

= 3.1.2 =
* Fix - Add payment method on My Account page error.

= 3.1.1 =
* Fix - Apple Pay error notice log link is incorrect.
* Fix - Apple Pay domain verification paths check.
Expand Down Expand Up @@ -150,6 +153,5 @@ If you get stuck, you can ask for help in the Plugin Forum.

== Upgrade Notice ==

= 3.1.1 =
* Fix - Apple Pay error notice log link is incorrect.
* Fix - Apple Pay domain verification paths check.
= 3.1.2 =
* Fix - Add payment method on My Account page error.
4 changes: 2 additions & 2 deletions woocommerce-gateway-stripe.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Take credit card payments on your store using Stripe.
* Author: WooCommerce
* Author URI: https://woocommerce.com/
* Version: 3.1.1
* Version: 3.1.2
* Text Domain: woocommerce-gateway-stripe
* Domain Path: /languages
*
Expand All @@ -32,7 +32,7 @@
/**
* Required minimums and constants
*/
define( 'WC_STRIPE_VERSION', '3.1.1' );
define( 'WC_STRIPE_VERSION', '3.1.2' );
define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
define( 'WC_STRIPE_MIN_WC_VER', '2.5.0' );
define( 'WC_STRIPE_MAIN_FILE', __FILE__ );
Expand Down

0 comments on commit d1c9a7d

Please sign in to comment.