bookingactivities / booking-activities

Wordpress plugin booking system
GNU General Public License v3.0
29 stars 10 forks source link

Feature request: Deactivate the link between the WC order status and its bookings' status #40

Open pikurasa opened 4 years ago

pikurasa commented 4 years ago

I just had an issue where I marked a customer's booking as "booked" (from the "bookings" page). I did not, however, mark it as paid.

However, in WooCommerce (WC), the status automatically updated to "complete". This was problematic because I had sent an invoice over to the customer that was not yet paid, so when they went to pay it (after I marked it as "booked"), the customer was unable to pay via the website as WC marked the transaction as complete.

Relevant notes from WC page (with Booking Group number redacted)

Order status changed from On hold to Completed.

November 24, 2019 at 3:47 pm Delete note

Booking group #__ state has been updated from Pending to Booked.

November 24, 2019 at 3:47 pm Delete note

Expected Behavior: I expect that WC maintain the status of "pending" until the admin has marked the payment as "complete" (or the payment has been made online).

yoancutillas commented 4 years ago

With WooCommerce, Booking Activities considers that a booking bound to an order item is "Booked" when the customer has paid.

You can disable the latest feature by adding this code to your child theme functions.php:

function my_theme_do_not_change_order_status_according_to_its_bookings_status( $new_order_status, $order ) {
    return $order->get_status();
}
add_filter( 'bookacti_woocommerce_order_status_automatically_updated', 'my_theme_do_not_change_order_status_according_to_its_bookings_status', 100, 2 );
pikurasa commented 4 years ago

Thanks for your response.

As for...

If the customer pays online (with Paypal, Stripe...), the booking status automatically becomes "Booked" after the payment.

The customer had not yet paid online.

If the customer pays offline, the booking status remain "Pending".

The customer did not choose pay offline. I (the admin) booked them for the activity and chose the "pay later" option, then sent them an invoice. I then changed the status to "booked" on the "bookings" page.

If the product price is 0, the booking status is determined by the settings in Booking Activities > Settings > General > "Default booking state" option.

The price was not "0".

If an administrator turns the order status to "Complete", its "Pending" bookings become "Booked"

I (the admin) had not changed the order status to complete.

If an administrator turns the booking status to "Booked" and all the items of the order are "Booked" bookings, then the order status becomes "Complete".

This sounds like what I did, but why is it designed this way? I wanted the (group of) activities to be reserved for the customer, but I still needed to invoice the customer (who had not yet paid). Please advise. Thanks!

As for the snippet of code -- thanks, I might try it.

yoancutillas commented 4 years ago

It is designed this way to keep that logic: A "Booked" booking bound to an order item = a paid booking, else it must be "Pending". So if all the bookings of the order are paid, the order becomes complete.

But you can deactivate it by code :)

Why did you had to change the booking status manually? A "Pending" booking does take an active slot, the event availibility is decreased. With the "Pay later" gateway, the booking status will become "Booked" as soon as the customer pays for the booking on your site.

yoancutillas commented 4 years ago

Do you still need help on that subject?

pikurasa commented 4 years ago

Do you still need help on that subject?

Sorry I was a bit busy...

With the "Pay later" gateway, the booking status will become "Booked" as soon as the customer pays for the booking on your site.

The order was tagged as "complete" by WooCommerce after using the "pay later" option, but before being paid.

For now, I know what the workaround is, so I will try to be more careful before sending invoices after using "pay later". Please keep this on your radar just in case other users run into the same issue.

yoancutillas commented 4 years ago

Sure, I note this feature request and wait for votes: add a toogle to deactivate the link between the WC order status and its bookings' status.

I wish you all the best for 2020!

edoardogiammarino commented 2 years ago

Sure, I note this feature request and wait for votes: add a toogle to deactivate the link between the WC order status and its bookings' status.

I wish you all the best for 2020!

I have a problem with that: every order in WC (since i started using the plugin), even if not a Booking, is now being marked as completed. How's that possible?

yoancutillas commented 2 years ago

It seems there is an error in the code,

can you replace wp-content/plugins/booking-activities/controller/controller-woocommerce-bookings.php line 285

if( $item_bookings_ids ) { $are_activities = false; } with if( ! $item_bookings_ids ) { $are_activities = false; } and try again?

However, this issue occurs only if there is at least one booking and one non-vitual product in cart, so it might not be the issue in your case.

edoardogiammarino commented 2 years ago

It seems there is an error in the code,

can you replace wp-content/plugins/booking-activities/controller/controller-woocommerce-bookings.php line 285

if( $item_bookings_ids ) { $are_activities = false; } with if( ! $item_bookings_ids ) { $are_activities = false; } and try again?

However, this issue occurs only if there is at least one booking and one non-vitual product in cart, so it might not be the issue in your case.

It seems that this solution has solved the problem for every order, even if there are no booking in it... Thanks. Maybe add that in the next update!

yoancutillas commented 2 years ago

Of course it will! Thank you for reporting.