Booking with status “Pending admin” when payment is aborted

Free and Premium WordPress Plugins & Themes Forums WordPress Plugins Hotel Booking Booking with status “Pending admin” when payment is aborted

  • This topic has 5 replies, 4 voices, and was last updated 12 months ago by J. Davis.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1409861
    Lucie Léger
    Participant

    Hello,

    I use Hotel Booking plugin with Bellevue theme for my website.
    I use Woocommerce with the plugin payment from my bank (Systempay is the name of the plugin).
    Everything works fine except one thing I would like to understand.

    The confirmation mode is “confirmation upon payment”.
    But, when a customer begins to book a night in the hotel and abort at the payment page, the booking is never automatically cancelled. The status is and stays “Pending admin”.
    The issue is that the date is blocked and the admin needs to delete manually the booking in order to have the date available again. And the admin never get an email or anything to know that one date is blocked.
    How can I do to make automatically available again a date once the payment is not proceeded, let’s say after 10 minutes for example ?
    Knowing that “pending payment time” is set to 10 in “Payment gateways” tab settings.

    Thank you in advance !

    #1412016
    Georgios Billis
    Participant

    I have the same issue.
    And I never get an email as well to get notified about this.
    So I always have to check the calendars to see if something like this has occurred.

    Please let me know if there is a solution for this issue.

    #1412615
    J. Davis
    Keymaster

    Hi,

    The status of the Booking is set to Pending Admin to let the customers finish the transaction if they failed to pay for the first time. You may check this reply or the whole thread to learn why it was adjusted https://motopress.com/forums/topic/payment-refused-and-later-accepted-not-handled-correctly/#post-921972
    So you need to navigate to Accommodation > Settings > Payment Gateways > WooCommerce and scroll down to the email template Manual Action Required Notice. Make sure this email template is not disabled and add proper recipients under the email template.
    If you wish to get the Booking canceled if it is not paid during a specific period you may try the following workaround:

    – go to WooCommerce > Settings > Products > Inventory
    – set Hold stock (minutes) as much as you need e.g. 15 minutes. So if the payment is not finished within 15 minutes its status will be changed to Canceled. However, this will not affect the status of the Booking as we disabled that action above. So there is a code below that switches the status of the unfinished payment to Failed and this should change the status of the Booking to Canceled automatically.

    remove_action( 'woocommerce_cancel_unpaid_orders', 'wc_cancel_unpaid_orders' );
    add_action( 'woocommerce_cancel_unpaid_orders', 'theme_wc_cancel_unpaid_orders' );
    
    function theme_wc_cancel_unpaid_orders() {
     $held_duration = get_option( 'woocommerce_hold_stock_minutes' );
    
     if ( $held_duration < 1 || 'yes' !== get_option( 'woocommerce_manage_stock' ) ) {
      return;
     }
    
     $data_store    = WC_Data_Store::load( 'order' );
     $unpaid_orders = $data_store->get_unpaid_orders( strtotime( '-' . absint( $held_duration ) . ' MINUTES', current_time( 'timestamp' ) ) );
    
     if ( $unpaid_orders ) {
      foreach ( $unpaid_orders as $unpaid_order ) {
          $order = wc_get_order( $unpaid_order );
    
          if ( apply_filters( 'woocommerce_cancel_unpaid_order', 'checkout' === $order->get_created_via(), $order ) ) {
        $order->update_status( 'failed', __( 'Unpaid order cancelled - time limit reached.', 'woocommerce' ) );
          }
      }
     }
     wp_clear_scheduled_hook( 'woocommerce_cancel_unpaid_orders' );
     wp_schedule_single_event( time() + ( absint( $held_duration ) * 60 ), 'woocommerce_cancel_unpaid_orders' );
    }

    You may add the code to the functions.php file of your child theme or by using a plugin like Code Snippets.

    best regards,
    John Davis

    #1414429
    Lucie Léger
    Participant

    Hi John,

    Thank you very much for your answer, I have followed your workaround and it seems to work well now !

    Best,
    Lucie.

    #1444833
    Sarah Rohrer
    Participant

    Hello

    I had the exactly same issue. The work-around seems to work and the reservation is cancelled after the 15 minutes.
    My Problem now is that the customer receives an e-mail that the booking has been cancelled, but if someone interrupt the booking process they will be confused why they get a cancellation of a booking they never made.

    Clearly i can deactivate the cancellation-mail, but then we have an issue with the customer that already booked and really want to cancel the booking. Is there another way to solve this problem?

    The next issue is that when we always get a notification when someone interrupt the booking process we will receive a lot of mails, do this function has to be activated to get this work around work?

    Thanks in advance!

    #1446468
    J. Davis
    Keymaster

    Hi Sarah.

    It is rather a custom request because the visitor of the site attempted to make a reservation on your site and reached the final spot before confirming it. In this case, you may add a notice for the guests who did not finish the payment that they may ignore the message if they changed their mind.

    best regards,
    John Davis

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.