...
Note |
---|
Add documentation for BE code |
Run cron in method execute
in file vendor/creativestyle/magesuite-auto-order-cancel/Cron/CancelOrders.php
Code Block |
---|
class CancelOrders
{
public function execute()
{
.....
$orderCanceller->execute();
}
} |
It runs method execute
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 orders 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.