Created
August 7, 2019 10:00
-
-
Save DevWael/89f1944e8659175e08eb518ebdb1f98a to your computer and use it in GitHub Desktop.
check if woocommerce cart is empty or not
This file contains hidden or 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 | |
function is_empty_cart() { | |
if ( ! class_exists( 'woocommerce' ) ) { | |
return false; //Woocpmmerce isn't isntalled | |
} | |
if ( sizeof( WC()->cart->get_cart() ) > 0 ) { | |
return false; //Cart is not empty | |
} | |
return true; //Cart is empty | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment