mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Fix lint
This commit is contained in:
parent
c6c6f10122
commit
d2fc0d3828
1 changed files with 18 additions and 10 deletions
|
@ -1532,17 +1532,25 @@ class SmartButton implements SmartButtonInterface {
|
||||||
*/
|
*/
|
||||||
private function sanitize_woocommerce_filters(): void {
|
private function sanitize_woocommerce_filters(): void {
|
||||||
|
|
||||||
// Sometimes external plugins like "woocommerce-one-page-checkout" set the $value to null.
|
add_filter(
|
||||||
// Here we also disable the mini-cart on cart-block and checkout-block pages where our buttons aren't supported yet.
|
'woocommerce_widget_cart_is_hidden',
|
||||||
add_filter( 'woocommerce_widget_cart_is_hidden', function ($value) {
|
/**
|
||||||
if (null === $value) {
|
* Sometimes external plugins like "woocommerce-one-page-checkout" set the $value to null, handle that case here.
|
||||||
|
* Here we also disable the mini-cart on cart-block and checkout-block pages where our buttons aren't supported yet.
|
||||||
|
*
|
||||||
|
* @psalm-suppress MissingClosureParamType
|
||||||
|
*/
|
||||||
|
function ( $value ) {
|
||||||
|
if ( null === $value ) {
|
||||||
if ( is_product() ) {
|
if ( is_product() ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return in_array($this->context(), array('cart', 'checkout', 'cart-block', 'checkout-block'));
|
return in_array( $this->context(), array( 'cart', 'checkout', 'cart-block', 'checkout-block' ), true );
|
||||||
}
|
}
|
||||||
return in_array($this->context(), array('cart-block', 'checkout-block')) ? true : $value;
|
return in_array( $this->context(), array( 'cart-block', 'checkout-block' ), true ) ? true : $value;
|
||||||
}, 11);
|
},
|
||||||
|
11
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue