Skip to content

Instantly share code, notes, and snippets.

@macgraphic
Created September 27, 2022 20:00
Show Gist options
  • Save macgraphic/69976d6c79ca4e616af235b8c12bcb49 to your computer and use it in GitHub Desktop.
Save macgraphic/69976d6c79ca4e616af235b8c12bcb49 to your computer and use it in GitHub Desktop.
// Add class to BODY if cart has items
function onze_cart_has_items( $classes ) {
if ( WC()->cart->get_cart_contents_count() >= 1 ) {
$classes[] = 'itemsInCart';
}
return $classes;
}
add_filter( 'body_class','onze_cart_has_items' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment