mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-07 19:54:15 +08:00
Add context for add payment method
This commit is contained in:
parent
cb7612851f
commit
29669b501a
3 changed files with 35 additions and 16 deletions
|
@ -644,7 +644,7 @@ document.querySelector("#payment").before(document.querySelector("#ppcp-messages
|
|||
return $this->settings->has( 'dcc_enabled' ) && $this->settings->get( 'dcc_enabled' )
|
||||
&& $this->settings->has( 'client_id' ) && $this->settings->get( 'client_id' )
|
||||
&& $this->dcc_applies->for_country_currency()
|
||||
&& in_array( $this->context(), array( 'checkout', 'pay-now' ), true );
|
||||
&& in_array( $this->context(), array( 'checkout', 'pay-now', 'add-payment-method' ), true );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -94,6 +94,10 @@ trait ContextTrait {
|
|||
return 'checkout';
|
||||
}
|
||||
|
||||
if ( $this->is_add_payment_method_page() ) {
|
||||
return 'add-payment-method';
|
||||
}
|
||||
|
||||
return 'mini-cart';
|
||||
}
|
||||
|
||||
|
@ -147,4 +151,16 @@ trait ContextTrait {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether current page is Add payment method.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function is_add_payment_method_page(): bool {
|
||||
global $wp;
|
||||
$page_id = wc_get_page_id( 'myaccount' );
|
||||
|
||||
return $page_id && is_page( $page_id ) && isset( $wp->query_vars['add-payment-method'] );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue