This commit is contained in:
Pedro Silva 2023-07-24 17:24:34 +01:00
parent c6c6f10122
commit d2fc0d3828
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3

View file

@ -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
);
} }