Skip to content

Commit 632fa60

Browse files
committed
Only check bookings if bookable products are not found
1 parent 1100256 commit 632fa60

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

WooCommerce/Classes/Bookings/BookingsTabEligibilityChecker.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,18 @@ final class BookingsTabEligibilityChecker: BookingsTabEligibilityCheckerProtocol
4545
return false
4646
}
4747

48-
async let hasBookableProducts = await checkIfStoreHasBookableProducts()
49-
async let hasBookings = await checkIfStoreHasBookings()
50-
51-
if await hasBookableProducts == false,
52-
await hasBookings == false {
53-
return false
54-
}
48+
// Check if store has bookable products or bookings
49+
let isVisible: Bool = await {
50+
if await checkIfStoreHasBookableProducts() {
51+
return true
52+
} else if await checkIfStoreHasBookings() {
53+
return true
54+
} else {
55+
return false
56+
}
57+
}()
5558

5659
// Cache the result
57-
let isVisible = true
5860
userDefaults.cacheBookingsTabVisibility(siteID: site.siteID, isVisible: isVisible)
5961

6062
return isVisible

0 commit comments

Comments
 (0)