Check Order
public function onCheckOrderCancellation( object $order ) : bool
Fires while checking whether the cancellation is allowed for the specified order.
Description
This filter can be used to apply additional conditions to the cancellation restrictions. Applies only for take-away orders.
When this hook is triggered, the system already validated the standard conditions and the cancellation has been approved for the usage.
In case of allowed cancellation, the page containing the details of the purchase will report a button to cancel the order.
Parameters
- $order
-
(VREOrderTakeaway) An object containing the details of the order that is going to be cancelled.
Return Value
Boolean. Use false to deny the cancellation.
Example
The example below prevents the cancellation for those customers that didn't pay the order online. In example, customers that selected the "Pay upon arrival" method of payment.
/**
* This filter can be used to apply additional conditions to the
* cancellation restrictions. When this hook is triggered, the
* system already validated the standard conditions and the
* cancellation has been approved for the usage.
*
* @param object $order The take-away order to check.
*
* @return bool Use false to deny the cancellation.
*/
public function onCheckOrderCancellation($order)
{
// prevent cancellation in case the order was not paid online
return $order->tot_paid > 0 ? true : false;
}
Changelog
Version | Description |
---|---|
1.8 | Introduced. |