init
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Esun\FreeGift\Observer;
|
||||
|
||||
use Magento\Framework\Event\Observer;
|
||||
use Magento\Framework\Event\ObserverInterface;
|
||||
use Magento\Quote\Model\Quote;
|
||||
|
||||
class ValidateGiftBeforeSubmit implements ObserverInterface
|
||||
{
|
||||
public function execute(Observer $observer): void
|
||||
{
|
||||
$quote = $observer->getEvent()->getQuote();
|
||||
if (!$quote instanceof Quote || !(int)$quote->getStoreId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$quote->setTotalsCollectedFlag(false);
|
||||
$quote->collectTotals();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user