get_cart_instance(); $cart_item_count = $cart ? $cart->get_cart_contents_count() : 0; // The following translation is a temporary workaround. It will be // reverted to the previous form `(%d items)` as soon as the // `@wordpress/i18n` package is available as a script module. // translators: %d number of items in the cart. $cart_item_text = __( '(items: %d)', 'woocommerce' ); wp_interactivity_config( $this->get_full_block_name(), array( 'itemsInCartTextTemplate' => $cart_item_text, ) ); wp_interactivity_state( $this->get_full_block_name(), array( 'itemsInCartText' => sprintf( $cart_item_text, $cart_item_count ), ) ); $wrapper_attributes = get_block_wrapper_attributes( array( 'data-wp-text' => 'state.itemsInCartText', 'data-wp-interactive' => 'woocommerce/mini-cart-title-items-counter-block', ) ); ob_start(); ?> > cart; if ( $cart && $cart instanceof \WC_Cart ) { return $cart; } return null; } }