woocommerce / woocommerce-accommodation-bookings

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

Accommodation booking is possible on Not available Day #321

Closed ankitguptaindia closed 1 year ago

ankitguptaindia commented 1 year ago

Found these scenarios at the time of testing PR https://github.com/woocommerce/woocommerce-accommodation-bookings/pull/303 Also happening with trunk branch as per finding here https://github.com/woocommerce/woocommerce-accommodation-bookings/pull/303#issuecomment-1379894352

Use Case- 1 Suppose a hotel is closed for cleaning on 6 Dec and Availability is set from Booking's Store Availability setting (refer to video explanation for more details). When the user tries to Check-in on the 5th Dec then it allows them to check-in but does not allow to check out on 6th. (All good till now.) But if a user doesn't select the checkout date then it is automatically select 6th (which is not available for checkout due to store availability ) and booking is completed on the not available day.

Video Explanation-

https://user-images.githubusercontent.com/6384299/205322747-6a80f60b-1c99-4a24-aae2-1a30c3f5a426.mp4

Use Case-2 Almost similar to the above but different booking rule: When some days are restricted from Booking "Restrict selectable days?" in the Booking setting and customer use those days in between bookings, those are getting booked.

https://user-images.githubusercontent.com/6384299/205326444-10b4c506-b4d9-4cce-acb9-7d99d03a9a83.mp4

Steps - Refer above videos for a detailed explanation of the steps.

Test Env-

` ### WordPress Environment ### WordPress address (URL): https://woolocal.local Site address (URL): https://woolocal.local WC Version: 7.2.3 REST API Version: ✔ 7.2.3 WC Blocks Version: ✔ 8.9.4 Action Scheduler Version: ✔ 3.4.0 Log Directory Writable: ✔ WP Version: 6.1.1 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: ✔ WP Cron: ✔ Language: en_US External object cache: – ### Server Environment ### Server Info: nginx/1.16.0 PHP Version: 8.0.0 PHP Post Max Size: 1,000 MB PHP Time Limit: 1200 PHP Max Input Vars: 4000 cURL Version: 7.54.0 LibreSSL/2.6.5 SUHOSIN Installed: – MySQL Version: 5.7.28 Max Upload Size: 300 MB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Database ### WC Database Version: 7.2.3 WC Database Prefix: wp_ Total Database Size: 102.65MB Database Data Size: 61.47MB Database Index Size: 41.18MB wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_order_items: Data: 0.13MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_order_itemmeta: Data: 1.52MB + Index: 0.72MB + Engine InnoDB wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_actions: Data: 2.02MB + Index: 0.63MB + Engine InnoDB wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_logs: Data: 1.02MB + Index: 0.28MB + Engine InnoDB wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_comments: Data: 7.52MB + Index: 9.09MB + Engine InnoDB wp_email_log: Data: 1.52MB + Index: 0.00MB + Engine InnoDB wp_gla_budget_recommendations: Data: 0.22MB + Index: 0.14MB + Engine InnoDB wp_gla_merchant_issues: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_gla_shipping_rates: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_gla_shipping_times: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mo2f_network_blocked_ips: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mo2f_network_email_sent_audit: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mo2f_network_transactions: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mo2f_network_whitelisted_ips: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mo2f_user_details: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mo2f_user_login_info: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_options: Data: 25.33MB + Index: 1.08MB + Engine InnoDB wp_postmeta: Data: 15.41MB + Index: 22.70MB + Engine InnoDB wp_posts: Data: 2.50MB + Index: 0.91MB + Engine InnoDB wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_term_relationships: Data: 0.13MB + Index: 0.06MB + Engine InnoDB wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_usermeta: Data: 0.13MB + Index: 0.16MB + Engine InnoDB wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wcpv_commissions: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wcpv_per_product_shipping_rules: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_admin_notes: Data: 0.06MB + Index: 0.00MB + Engine InnoDB wp_wc_admin_note_actions: Data: 0.05MB + Index: 0.02MB + Engine InnoDB wp_wc_bookings_availability: Data: 0.09MB + Index: 0.05MB + Engine InnoDB wp_wc_bookings_availabilitymeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_booking_relationships: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_deposits_payment_plans: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_deposits_payment_plans_schedule: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_orders: Data: 0.38MB + Index: 0.33MB + Engine InnoDB wp_wc_orders_meta: Data: 1.52MB + Index: 3.03MB + Engine InnoDB wp_wc_order_addresses: Data: 0.20MB + Index: 0.28MB + Engine InnoDB wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_operational_data: Data: 0.17MB + Index: 0.09MB + Engine InnoDB wp_wc_order_product_lookup: Data: 0.09MB + Index: 0.06MB + Engine InnoDB wp_wc_order_stats: Data: 0.08MB + Index: 0.05MB + Engine InnoDB wp_wc_order_tax_lookup: Data: 0.05MB + Index: 0.03MB + Engine InnoDB wp_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_product_meta_lookup: Data: 0.25MB + Index: 0.45MB + Engine InnoDB wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_square_customers: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpns_attack_logs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpns_backup_report: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpns_files_scan: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wpns_ip_rate_details: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpns_malware_hash_file: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wpns_malware_scan_report: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpns_malware_scan_report_details: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpns_malware_skip_files: Data: 0.02MB + Index: 0.00MB + Engine InnoDB ### Post Type Counts ### attachment: 63 bookable_person: 95 bookable_resource: 227 event_ticket: 180 event_ticket_email: 5 global_product_addon: 1 nav_menu_item: 4 page: 22 post: 15 product: 739 product_variation: 37 revision: 281 shop_coupon: 3 shop_order: 880 shop_order_refund: 38 shop_subscription: 6 wc_booking: 2876 wc_membership_plan: 1 wc_order_status: 9 wc_user_membership: 1 wp_global_styles: 2 wp_template_part: 1 ### Security ### Secure connection (HTTPS): ✔ Hide errors from visitors: ❌Error messages should not be shown to visitors. ### Active Plugins (4) ### WooCommerce Accommodation Bookings: by WooCommerce – 1.1.36 WooCommerce Bookings: by WooCommerce – 1.15.70 WooCommerce Stripe Gateway: by WooCommerce – 7.0.2 WooCommerce: by Automattic – 7.2.3 ### Inactive Plugins (38) ### Bookings Generator: by WooCommerce – 1.0.0 Bookings Helper: by WooCommerce – 1.0.3 Copy & Delete Posts: by Copy Delete Posts – 1.3.7 Custom Order Numbers for WooCommerce: by Tyche Softwares – 1.4.0 Debug Log - Config Tool: by Lukman Nakib – 1.1 Email Log: by Sudar – 2.4.8 Gutenberg: by Gutenberg Team – 14.9.1 PHP Compatibility Checker: by WP Engine – 1.6.0 Pig Latin: by Nikolay Bachiyski – 0.2 Plugin Toggle: by Cedaro – 1.3.1 Publisher Media Kit: by 10up – 1.3.0 Query Monitor: by John Blackbourn – 3.11.1 Remove Duplicate Posts: by Muhammad Rehman – 1.3.4 RTL Tester: by Yoav Farhi Automattic – 1.2 SimpleUnserializePOC: by SimpleUnserializePOC – 1.1 WooCommerce Accommodation Bookings Stable: by WooCommerce – 1.1.36 WooCommerce Blocks: by Automattic – 9.3.0 WooCommerce Bookings Availability: by WooCommerce – 1.1.24 WooCommerce Bookings Stb: by WooCommerce – 1.15.69 WooCommerce Box Office: by WooCommerce – 1.1.44 WooCommerce Currency Converter: by WooCommerce – 1.6.29 WooCommerce Deposits: by WooCommerce – 2.1.0 WooCommerce EU VAT Number: by WooCommerce – 2.7.0 WooCommerce Memberships: by SkyVerge – 1.22.9 WooCommerce Min/Max Quantities: by WooCommerce – 3.0.0 WooCommerce Multi-currency: by TIV.NET INC – 2.14.3 WooCommerce Order Status Manager: by SkyVerge – 1.13.4 WooCommerce PayFast Gateway: by WooCommerce – 1.5.0 WooCommerce PDF Invoices: by Andrew Benbow – 4.15.6 WooCommerce Pre-Orders: by WooCommerce – 1.7.1 WooCommerce Product Add-ons: by WooCommerce – 4.4.0 WooCommerce Product CSV Import Suite: by WooCommerce – 1.10.48 WooCommerce Product Vendors: by WooCommerce – 2.1.70 WooCommerce Purchase Order Payment Gateway: by WooCommerce – 1.2.13 WooCommerce Subscriptions: by WooCommerce – 3.1.3 WP Crontrol: by John Blackbourn & crontributors – 1.15.1 WP Downgrade | Specific Core Version: by Reisetiger – 1.2.5 WP Rollback: by GiveWP.com – 1.7.3 ### Settings ### API Enabled: – Force SSL: – Currency: USD ($) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: accommodation-booking (accommodation-booking) booking (booking) external (external) grouped (grouped) simple (simple) subscription (subscription) variable (variable) variable subscription (variable-subscription) Taxonomies: Product Visibility: exclude_from_catalog (exclude_from_catalog) exclude_from_search (exclude_from_search) exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) Connected to WooCommerce.com: – Enforce Approved Product Download Directories: – Order datastore: WC_Order_Data_Store_CPT ### WC Pages ### Shop base: #6 - /shop/ Cart: #7 - /cart/ Checkout: #8 - /checkout/ My account: #9 - /my-account/ Terms and conditions: ❌ Page not set ### Theme ### Name: Storefront Version: 4.2.0 Author URL: https://woocommerce.com/ Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme WooCommerce Support: ✔ ### Templates ### Overrides: .DS_Store ### Templates ### Overrides: .DS_Store ### Admin ### Enabled Features: activity-panels analytics coupons customer-effort-score-tracks experimental-products-task experimental-import-products-task experimental-fashion-sample-products shipping-smart-defaults shipping-setting-tour homescreen marketing multichannel-marketing mobile-app-banner navigation onboarding onboarding-tasks remote-inbox-notifications remote-free-extensions payment-gateway-suggestions shipping-label-banner subscriptions store-alerts transient-notices woo-mobile-welcome wc-pay-promotion wc-pay-welcome-page Disabled Features: minified-js new-product-management-experience settings Daily Cron: ✔ Next scheduled: 2023-01-12 11:14:46 +05:30 Options: ✔ Notes: 112 Onboarding: completed ### Action Scheduler ### Complete: 1,512 Oldest: 2022-12-13 15:38:25 +0530 Newest: 2023-01-12 15:48:10 +0530 Failed: 3 Oldest: 2022-11-23 13:04:39 +0530 Newest: 2022-11-23 18:57:34 +0530 Pending: 9 Oldest: 2023-01-12 15:51:11 +0530 Newest: 2023-04-22 16:15:16 +0530 ### Status report information ### Generated at: 2023-01-12 15:50:17 +05:30 `
ankitguptaindia commented 1 year ago

@faisal-alvi As discussed https://github.com/woocommerce/woocommerce-accommodation-bookings/pull/303#issuecomment-1379894352, I added issues here on this ticket to discuss/fix.

@jeffpaul @vikrampm1

faisal-alvi commented 1 year ago

IMO,

I think that is expected behavior because the 6th Dec seems to be closed for new check-ins, but existing visitors can check out on that day. If we block the 5th Dec for check-ins, Hotel will lose an extra booking day.

Comment source: https://github.com/woocommerce/woocommerce-accommodation-bookings/pull/303#issuecomment-1370684378

On the unavailable days, we must decide what to restrict: do we restrict only check-ins, only checkouts, or both? There will be at least 2 days of booking loss if we prevent both. I believe that we should merely suspend check-ins (which the plugin does already but it does not allow users to select an "unavailable day" as a "checkout day", it is seen selected in the cart as shown in the video above).

cc @dkotter

jeffpaul commented 1 year ago

If the store/hotel/whatever has a day set as unavailable, there should be no options to check in or out on that day. If they're closed on the 6th (for whatever reason) then it would seem with the example above that you could only checkin & out on the 5th with no bookings that span across the 6th.

rtpHarry commented 1 year ago

I'm having similar problems to this, I think. If you select a date that doesn't have any minimum stay length, then it will try to quote it for 1 night, without forcing you to select an end date.

This means that at the end of the season you can select a check in and it will let you book for the last day, which should be a check-out only day.

jeffpaul commented 1 year ago

@rtpHarry I could see a case where there's no minimum block set (e.g. 1 day) that would allow this sort of booking, so either that case is intended or the store owner should update their settings to ensure that sort of booking is not feasible

faisal-alvi commented 1 year ago

@ankitguptaindia While attempting to resolve this problem, I discovered that it has already been resolved in PR https://github.com/woocommerce/woocommerce-bookings/pull/3328. You may verify that the problem is no longer reproducible in the trunk by checking. Once you confirm, we can close this ticket.

image

Now when we select a check-in day just one day before the unavailable day, we see a note Sorry, the selected block is not available.

ankitguptaindia commented 1 year ago

Thanks @faisal-alvi for checking this. I will cross-check and update here.

ankitguptaindia commented 1 year ago

Hello @faisal-alvi

Upon further investigation, I have confirmed that Use Case- 1 has been resolved by trunk branch. However, Use Case- 2 has yet to be addressed and requires further attention as this didn't fix by PR https://github.com/woocommerce/woocommerce-bookings/pull/3328

https://user-images.githubusercontent.com/6384299/217445705-4a150dcb-ff5f-493e-8cb4-356c39b8e6b3.mp4

faisal-alvi commented 1 year ago

@ankitguptaindia I appreciate your efforts to identify and report the issue. However, upon reviewing the details again, I still do not believe that this is a bug, but rather a feature that is working as intended.

As a store owner, I would like to block bookings on Saturdays and Sundays but still allow them on Fridays. In this case, it would be expected that bookings made on Fridays would end on Saturdays, and that is fine.

If we were to consider this as a bug and implement a fix to block check-outs on Saturdays, it would block bookings on Fridays as well. As a result, a store owner who only wants Saturdays and Sundays to be unavailable would have to manually block Sundays while expecting Saturdays to be automatically blocked, which does not seem ideal. They would choose both days in a back end and make them unavailable if they wanted Saturdays and Sundays to be restricted, not just Sundays.

cc: @dkotter

dkotter commented 1 year ago

Watching the video that Ankit has for use case 2, the problem as I understand it is we have a product that should not be available on Saturdays or Sundays but if you create a booking starting on Friday, that booking is allowed to span Saturday and Sunday and end on a Monday or Tuesday. That does seem like a bug in my mind. In this scenario, my assumption as a store owner is that you could have a booking that checks-in on Friday and checks-out on Saturday, but no check-ins on Saturday and no check-ins or check-outs on Sunday.

This does get into the idea of adding the ability to restrict days for check-ins and check-outs separately from restricting an entire day, which makes more sense in my mind for this extension, though it's just inheriting what Bookings has.

faisal-alvi commented 1 year ago

@dkotter @ankitguptaindia I have investigated and debugged in the codebase and there does not seem anything coded to prevent bookings through the non-restricted days (Saturday & Sunday in our example).

Also, I found that as per the doc, the restricted days are to allow customers to start or end on the ticketed restricted days and still allow them to book through the non-restricted days but not able to select them.

Restrict the days of the week that can be selected on the calendar; this will not affect your availability.

image


If we want to disallow booking through Saturdays and Sundays, we need to add an availability rule instead of using the restricted days option.

With Restricted days With Availability Rule
image image
image image
faisal-alvi commented 1 year ago

Closing considering expected behaviors, not bugs. Feel free to re-open if required.