Magento 2 How to Identify Payment method is offline or online after place order
Offline Payment methods are Cash on delivery, Check/Money order, Bank transfer.
Online Payment methods are Amazon,Braintree,Paypal, Authorize.net and many more online payments available.
You can check payment method is offline or online using programmatically by
result will offline payment method with 0 or 1.
please check with below code for Observer. event name is sales_order_place_after
Online Payment methods are Amazon,Braintree,Paypal, Authorize.net and many more online payments available.
You can check payment method is offline or online using programmatically by
$order->getPayment()->getMethodInstance()->isOffline()
result will offline payment method with 0 or 1.
please check with below code for Observer. event name is sales_order_place_after
public function execute(\Magento\Framework\Event\Observer $observer)
{
$order = $observer->getOrder();
$isOffline = $order->getPayment()->getMethodInstance()->isOffline();
if ($isOffline) {
echo __('offline');
} else {
echo __('online');
}
}
Comments
Post a Comment