mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 13:44:42 +08:00
Do not disable card funding source for free trial if DCC enabled
Otherwise DCC gateway gets disabled (paypal.HostedFields.isEligible() becomes false)
This commit is contained in:
parent
1c92a56e69
commit
a5191b04ff
1 changed files with 9 additions and 2 deletions
|
@ -898,7 +898,10 @@ class SmartButton implements SmartButtonInterface {
|
|||
if ( ! is_checkout() ) {
|
||||
$disable_funding[] = 'card';
|
||||
}
|
||||
if ( is_checkout() && $this->settings->has( 'dcc_enabled' ) && $this->settings->get( 'dcc_enabled' ) ) {
|
||||
|
||||
$is_dcc_enabled = $this->settings->has( 'dcc_enabled' ) && $this->settings->get( 'dcc_enabled' );
|
||||
|
||||
if ( is_checkout() && $is_dcc_enabled ) {
|
||||
$key = array_search( 'card', $disable_funding, true );
|
||||
if ( false !== $key ) {
|
||||
unset( $disable_funding[ $key ] );
|
||||
|
@ -906,7 +909,11 @@ class SmartButton implements SmartButtonInterface {
|
|||
}
|
||||
|
||||
if ( $this->is_free_trial_cart() ) {
|
||||
$disable_funding = array_keys( $this->all_funding_sources );
|
||||
$all_sources = $this->all_funding_sources;
|
||||
if ( $is_dcc_enabled ) {
|
||||
$all_sources = array_keys( array_diff_key( $all_sources, array( 'card' => '' ) ) );
|
||||
}
|
||||
$disable_funding = $all_sources;
|
||||
}
|
||||
|
||||
if ( count( $disable_funding ) > 0 ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue