Skip to content

Instantly share code, notes, and snippets.

View nbhgyhu8ijokmjhbui's full-sized avatar

nbhgyhu8ijokmjhbui

View GitHub Profile
@bryceadams
bryceadams / gist:db6c8669e9e99cb2808c
Last active October 9, 2023 13:55
Clear WooCommerce Cart (when not cart/checkout)
/**
* Clears WC Cart on Page Load
* (Only when not on cart/checkout page)
*/
add_action( 'wp_head', 'bryce_clear_cart' );
function bryce_clear_cart() {
if ( wc_get_page_id( 'cart' ) == get_the_ID() || wc_get_page_id( 'checkout' ) == get_the_ID() ) {
return;
}