diff --git a/header.php b/header.php index 6547d1d10..087448833 100644 --- a/header.php +++ b/header.php @@ -15,6 +15,13 @@ +' ) : null; +?> + diff --git a/inc/class-storefront.php b/inc/class-storefront.php index 31bd5a127..6202b2b92 100644 --- a/inc/class-storefront.php +++ b/inc/class-storefront.php @@ -247,6 +247,13 @@ public function setup() { ), ) ); + + /** + * Add support for block emplate parts. + * + * @return void + */ + add_theme_support( 'block-template-parts' ); } /** diff --git a/inc/woocommerce/storefront-woocommerce-template-functions.php b/inc/woocommerce/storefront-woocommerce-template-functions.php index 8630aa2c6..74a879a5c 100644 --- a/inc/woocommerce/storefront-woocommerce-template-functions.php +++ b/inc/woocommerce/storefront-woocommerce-template-functions.php @@ -115,6 +115,16 @@ function storefront_product_search() { } } +/** + * Returns the output for the mini-cart block. + * + * @return string + */ +function storefront_get_block_mini_cart() { + global $storefront_block_mini_cart; + return $storefront_block_mini_cart ?? ''; +} + if ( ! function_exists( 'storefront_header_cart' ) ) { /** * Display Header Cart @@ -124,6 +134,7 @@ function storefront_product_search() { * @return void */ function storefront_header_cart() { + $block_mini_cart = storefront_get_block_mini_cart(); if ( storefront_is_woocommerce_activated() ) { if ( is_cart() ) { $class = 'current-menu-item'; @@ -131,14 +142,21 @@ function storefront_header_cart() { $class = ''; } ?> - +