diff --git a/modules/ppcp-button/src/Assets/SmartButton.php b/modules/ppcp-button/src/Assets/SmartButton.php index 2420b9277..b1a45a637 100644 --- a/modules/ppcp-button/src/Assets/SmartButton.php +++ b/modules/ppcp-button/src/Assets/SmartButton.php @@ -354,6 +354,27 @@ class SmartButton implements SmartButtonInterface { add_action( $this->pay_order_renderer_hook(), array( $this, 'button_renderer' ), 10 ); + $not_enabled_on_minicart = $this->settings->has( 'button_mini_cart_enabled' ) && + ! $this->settings->get( 'button_mini_cart_enabled' ); + if ( + ! $not_enabled_on_minicart + ) { + add_action( + $this->mini_cart_button_renderer_hook(), + static function () { + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison + if ( WC()->cart->get_cart_contents_total() == 0 ) { + return; + } + echo '

'; + }, + 30 + ); + } + if ( $this->is_cart_price_total_zero() ) { return false; } @@ -374,23 +395,6 @@ class SmartButton implements SmartButtonInterface { ); } - $not_enabled_on_minicart = $this->settings->has( 'button_mini_cart_enabled' ) && - ! $this->settings->get( 'button_mini_cart_enabled' ); - if ( - ! $not_enabled_on_minicart - ) { - add_action( - $this->mini_cart_button_renderer_hook(), - static function () { - echo '

'; - }, - 30 - ); - } - add_action( $this->checkout_button_renderer_hook(), array( $this, 'button_renderer' ), 10 ); return true;