mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
Merge pull request #1807 from woocommerce/PCP-2173-fix-cart-paylater
Pay Later messaging disappears when updating shipping option on cart page
This commit is contained in:
commit
c051e8ddc0
1 changed files with 23 additions and 1 deletions
|
@ -34,6 +34,28 @@ trait ContextTrait {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks WC is_cart() + WC cart ajax requests.
|
||||
*/
|
||||
private function is_cart(): bool {
|
||||
if ( is_cart() ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The filter returning whether to detect WC cart ajax requests.
|
||||
*/
|
||||
if ( apply_filters( 'ppcp_check_ajax_cart', true ) ) {
|
||||
// phpcs:ignore WordPress.Security
|
||||
$wc_ajax = $_GET['wc-ajax'] ?? '';
|
||||
if ( in_array( $wc_ajax, array( 'update_shipping_method' ), true ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The current context.
|
||||
*
|
||||
|
@ -56,7 +78,7 @@ trait ContextTrait {
|
|||
return 'cart-block';
|
||||
}
|
||||
|
||||
if ( is_cart() ) {
|
||||
if ( $this->is_cart() ) {
|
||||
return 'cart';
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue