// For each item in cart
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
// Get product
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
// Get custom attribute
$foobar = $_product->get_attribute( 'myCustomAttribute' );
$foobar == true ? $foo = "true" : $foo = "false";
}