mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Merge pull request #696 from woocommerce/pcp-479-remove-dcc-continuation
Do not enter the checkout continuation state for dcc
This commit is contained in:
commit
b118c4b60c
2 changed files with 26 additions and 3 deletions
|
@ -234,7 +234,6 @@ class SmartButton implements SmartButtonInterface {
|
|||
if (
|
||||
$this->settings->has( 'dcc_enabled' )
|
||||
&& $this->settings->get( 'dcc_enabled' )
|
||||
&& ! $this->session_handler->order()
|
||||
) {
|
||||
add_action(
|
||||
$this->checkout_dcc_button_renderer_hook(),
|
||||
|
@ -1077,7 +1076,7 @@ class SmartButton implements SmartButtonInterface {
|
|||
if ( is_cart() ) {
|
||||
$context = 'cart';
|
||||
}
|
||||
if ( is_checkout() && ! $this->session_handler->order() ) {
|
||||
if ( is_checkout() && ! $this->is_paypal_continuation() ) {
|
||||
$context = 'checkout';
|
||||
}
|
||||
if ( is_checkout_pay_page() ) {
|
||||
|
@ -1086,6 +1085,23 @@ class SmartButton implements SmartButtonInterface {
|
|||
return $context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if PayPal payment was already initiated (on the product or cart pages).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function is_paypal_continuation(): bool {
|
||||
$order = $this->session_handler->order();
|
||||
if ( ! $order ) {
|
||||
return false;
|
||||
}
|
||||
$source = $order->payment_source();
|
||||
if ( $source && $source->card() ) {
|
||||
return false; // Ignore for DCC.
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether DCC is enabled or not.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue