preOrderStatusUpdate
The preOrderStatusUpdate hook is called before the order status is updated.
Parameters
-
\Isotope\Model\ProductCollection\Order
$orderThe order model.
-
\Isotope\Model\OrderStatus
$newStatusThe new order status.
-
array $updatesThe order status updates.
Return Values
Return true to cancel the order status change.
Example
// src/EventListener/Isotope/PreOrderStatusUpdateListener.php
namespace App\EventListener\Isotope;
use Isotope\Model\OrderStatus;
use Isotope\Model\ProductCollection\Order;
use Isotope\ServiceAnnotation\IsotopeHook;
/**
* @IsotopeHook("preOrderStatusUpdate")
*/
class PreOrderStatusUpdateListener
{
public function __invoke(Order $order, OrderStatus $newsStatus, array $updates): bool
{
// Cancel the order status change if the order is not paid.
if (!$order->isPaid()) {
return true;
}
return false;
}
}