Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save smoen-godaddy/7a42517e7d28600a203daefc0ee70c21 to your computer and use it in GitHub Desktop.
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
<?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