...
Note |
---|
Add documentation for BE code |
Cron runs execute
method in file vendor/creativestyle/magesuite-auto-order-cancel/Cron/CancelOrders.php
Code Block |
---|
class CancelOrders
{
public function execute()
{
.....
$orderCanceller->execute();
}
} |
It runs also execute
method in service vendor/creativestyle/magesuite-auto-order-cancel/Service/OrderCanceller.php
It calls method cancelUnpaidOrders
where:
we get collection with orders which need to be canceled
than for each order all invoices are canceled and than given order is canceled
Code Block |
---|
class OrderCanceller
{
public function execute():void
{
foreach ($this->storeManager->getStores() as $store) {
.....
$this->cancelUnpaidOrders($storeId);
}
}
public function cancelUnpaidOrders(?int $storeId = null):void
{
$orders = $this->ordersToCancelCollection->getOrders($storeId);
foreach ($orders as $order) {
.....
$this->cancelInvoices($order);
$this->orderManagement->cancel($order->getEntityId());
.....
}
}
protected function cancelInvoices(\Magento\Sales\Model\Order $order):void
{
foreach ($order->getInvoiceCollection() as $invoice) {
$invoice->cancel();
.....
}
}
} |
Frontend
The module does not provide any functionality for the storefront.