Empty cart if user is logged in

function twstudio_woocommerce_clear_cart() {
	global $woocommerce;
	if ( is_user_logged_in() ) {
		$woocommerce->cart->empty_cart();
	}
}
add_action( 'init', 'twstudio_woocommerce_clear_cart' );

Leave a Reply

Your email address will not be published. Required fields are marked *