diff --git a/plugins/woocommerce-blocks/assets/js/base/components/notice-banner/style.scss b/plugins/woocommerce-blocks/assets/js/base/components/notice-banner/style.scss index 45a757f419d..6f80588b349 100644 --- a/plugins/woocommerce-blocks/assets/js/base/components/notice-banner/style.scss +++ b/plugins/woocommerce-blocks/assets/js/base/components/notice-banner/style.scss @@ -46,7 +46,7 @@ .wc-forward { float: right; color: $gray-800 !important; - background: transparent; + background: transparent !important; // For transparent notice button in Twenty Twenty-One theme. padding: 0 !important; margin: 0; border: 0; @@ -70,6 +70,7 @@ background-color: $gray-800; flex-shrink: 0; flex-grow: 0; + height: 100%; } > .wc-block-components-button { diff --git a/plugins/woocommerce-blocks/src/Domain/Services/Notices.php b/plugins/woocommerce-blocks/src/Domain/Services/Notices.php index 12090af3cf1..0d060645167 100644 --- a/plugins/woocommerce-blocks/src/Domain/Services/Notices.php +++ b/plugins/woocommerce-blocks/src/Domain/Services/Notices.php @@ -38,23 +38,12 @@ class Notices { } /** - * Set all hooks related to adding Checkout Draft order functionality to Woo Core. This is only enabled if the user - * is using the new block based cart/checkout. + * Initialize notice hooks. */ public function init() { - if ( CartCheckoutUtils::is_cart_block_default() || CartCheckoutUtils::is_checkout_block_default() ) { - add_filter( 'woocommerce_kses_notice_allowed_tags', [ $this, 'add_kses_notice_allowed_tags' ] ); - add_filter( 'wc_get_template', [ $this, 'get_notices_template' ], 10, 5 ); - add_action( - 'wp_head', - function() { - // These pages may return notices in ajax responses, so we need the styles to be ready. - if ( is_cart() || is_checkout() ) { - wp_enqueue_style( 'wc-blocks-style' ); - } - } - ); - } + add_filter( 'woocommerce_kses_notice_allowed_tags', [ $this, 'add_kses_notice_allowed_tags' ] ); + add_filter( 'wc_get_template', [ $this, 'get_notices_template' ], 10, 5 ); + add_action( 'wp_head', [ $this, 'enqueue_notice_styles' ] ); } /** @@ -101,4 +90,13 @@ class Notices { } return $template; } + + /** + * Replaces all notices with the new block based notices. + * + * @return void + */ + public function enqueue_notice_styles() { + wp_enqueue_style( 'wc-blocks-style' ); + } }