I need to get the 'Cash On Delivery' payment method if it is selected.
I Cannot get the payment method name. The
getMethodInstance()
and getTitle()
are not working. See the code I used below:
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$cart = $objectManager->get('\Magento\Checkout\Model\Cart');
$itemsCollection = $cart->getQuote();
$it = $itemsCollection->getPayment();
$iit = $it->getMethod();