nmn
January 23, 2023, 12:33pm
1
With the help of this page, we were able to hide the Cancel button only when ‘Processing’.
Our scenario involves Manual Payouts to be clear on my question below.
When the order status of a booking in WooCommerce is “Processing” can we hide the “Cancel Booking” button if a user goes to the booking details page to view that booking?
Technically the only way a user should be able to cancel a booking at this point is by submitting a “dispute” on the order details page.
Is there a PHP Snippet that can be provided to easily do this?
Thanks,
Tom
In the same way, I want to make it impossible to cancel an order that has been paid for.
We want to ensure that neither the user nor the vendor can cancel an order for which payment has been completed.
Only the operator can cancel.
Is it possible to do so?
Thank you.
andrii
January 24, 2023, 4:06pm
4
Hi,
Please try this PHP snippet:
add_filter(
'hivepress/v1/templates/booking_view_page/blocks',
function ($blocks, $template){
$order = $template->get_context('order');
if(!$order){
return $blocks;
}
$order_status = $order->get_status();
if(!$order_status || !in_array($order_status, ['processing', 'completed'])){
return $blocks;
}
hivepress()->template->fetch_block($blocks, 'booking_cancel_link');
return $blocks;
},
1000,
2
);
Please note that it can require further customization.
1 Like
nmn
January 25, 2023, 3:42am
5
Thank you! You’ve been a great help!!
Abe
January 25, 2023, 1:40pm
8
Wow! This code works for the vendor and for the user. That’s great!
Thanks!
2 Likes
system
Closed
February 24, 2023, 1:41pm
9
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.