woocommerce / woocommerce-accommodation-bookings

An accommodations add-on for the WooCommerce Bookings extension.
91 stars 31 forks source link

Check-in/out times are always displayed in the product data tabs #314

Open maxlaf opened 2 years ago

maxlaf commented 2 years ago

Affected ticket(s)

5647172-zen

What I expected

If the check-in/out time isn't set under Bookings > Settings > Accommodation, it shouldn't be displayed in the product data tabs.

What happened instead

If the check-in/out time isn't set by the user, it defaults to 14:00.

Steps to reproduce the issue

  1. Install Accommodation Bookings. Don't set the check-in/out times.
  2. Create an Accommdation booking product.
  3. View product. Check-in/out times are displayed

Additional Info

From my amateur glance, it looks like the Arrival/Departure tab shouldn't be displayed if the check-in/out times are empty: https://github.com/woocommerce/woocommerce-accommodation-bookings/blob/145f6434109a974e0fd50543fb91b7998a68862a/includes/class-wc-accommodation-booking-product-tabs.php#L77

But get_check_times returns 14:00 if it's not set: https://github.com/woocommerce/woocommerce-accommodation-bookings/blob/145f6434109a974e0fd50543fb91b7998a68862a/includes/class-wc-product-accommodation-booking.php#L343

F7QIQs.png 2b673W.png


faisal-alvi commented 2 years ago

@maxlaf seems like the reason is that there must be check-in and out times set. Otherwise, customers may get confused about when they should arrive and/or when they have to leave. I think this is why the plugin sets 2 PM as a default in/out time. Removing the Arrival/Departure tab would mean that we also need to tweak the code and have to assume and set another in/out time (maybe 12 AM?) because, without it, we can not calculate the availability. But again that does not worth it because we again end up assuming/setting another default time, i.e. 12 AM.

Perhaps we should display 2 PM on the setting page instead of just "--:-- --", if store owner does not set any time.