Try this code by using global $woocommerce
add_action( 'wp_logout', 'force_clear_woocommerce_cart' );
function force_clear_woocommerce_cart()
{
error_log("Clearing cart");
global $woocommerce;
$woocommerce->cart->empty_cart();
}
hope this will help you