* Enable new notice styles

* Fix Twenty Twenty-One button background color issue
This commit is contained in:
Niels Lange 2023-12-06 15:46:22 +07:00 committed by GitHub
parent 1f410bdd04
commit 69ef1b96e8
2 changed files with 15 additions and 16 deletions

View File

@ -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 {

View File

@ -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' );
}
}