Skip to content

Instantly share code, notes, and snippets.

View smoen-godaddy's full-sized avatar

smoen-godaddy

View GitHub Profile
@smoen-godaddy
smoen-godaddy / wc-cart-notices-remove-at-checkout.php
Created June 25, 2024 10:25
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 );