Created
June 25, 2024 10:25
-
-
Save smoen-godaddy/7a42517e7d28600a203daefc0ee70c21 to your computer and use it in GitHub Desktop.
Removes WooCommerce cart notices at checkout, leaving them only on the cart page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// only copy opening php tag if needed | |
// Removes cart notices from the checkout page | |
function sv_wc_cart_notices_remove_on_checkout() { | |
if ( is_checkout() ) { | |
remove_action( 'wp', array( wc_cart_notices(), 'add_cart_notices' ) ); | |
} | |
} | |
add_action( 'wp', 'sv_wc_cart_notices_remove_on_checkout', 5 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment