25 lines
639 B
PHP
25 lines
639 B
PHP
<?php
|
|
|
|
namespace Lts\Checkout\Observer;
|
|
|
|
use Lts\Catalog\Helper\ShowProductOrNot;
|
|
use Magento\Framework\Event\Observer;
|
|
|
|
class CheckCustomer implements \Magento\Framework\Event\ObserverInterface
|
|
{
|
|
private ShowProductOrNot $showProductOrNot;
|
|
|
|
public function __construct(
|
|
ShowProductOrNot $showProductOrNot
|
|
)
|
|
{
|
|
$this->showProductOrNot = $showProductOrNot;
|
|
}
|
|
|
|
public function execute(Observer $observer)
|
|
{
|
|
if (!$this->showProductOrNot->checkByNetsuiteStatus()) {
|
|
throw new \Magento\Framework\Exception\LocalizedException(__('You cannot purchase right now.'));
|
|
}
|
|
}
|
|
} |