cart ) ? (int) WC()->cart->get_cart_contents_count() : 0; if ( $count > 0 ) { if ( method_exists( 'AIEO_Page_Cache', 'keep_out' ) ) { AIEO_Page_Cache::keep_out(); } else { if ( ! defined( 'DONOTCACHEPAGE' ) ) { define( 'DONOTCACHEPAGE', true ); } if ( ! headers_sent() ) { header( 'X-Rooster-No-Cache: 1' ); } } } wp_interactivity_state( 'rooster/cart', [ 'count' => $count, 'srText' => $count ? (string) $count : '', 'hidden' => static function () use ( $count ): bool { $context = wp_interactivity_get_context(); return ! $count && empty( $context['showZero'] ); }, ] ); $wrapper = get_block_wrapper_attributes( [ 'class' => 'rooster-badge rooster-badge--cart rooster-action rooster-action--cart' . ( Rooster\Core\Blocks::labeled( 'cart' ) ? ' rooster-action--labeled' : '' ), 'data-wp-interactive' => 'rooster/cart', 'data-wp-context' => wp_json_encode( [ 'showZero' => ! empty( $attributes['showZero'] ) || Rooster\Core\Blocks::badge_zero() ] ), ] ); AIEO_Engine_Blocks::out( sprintf( '%4$s%5$s', $wrapper, esc_url( wc_get_cart_url() ), esc_attr( $label ), rooster_icon( $glyph, [ 'width' => 22, 'height' => 22 ] ), esc_html( $label ) ) );