I'm modifying mercadopago module, and i need to work with the checkout session. When i use this function


It returns false. My class is:

class Payment
    extends \Magento\Payment\Model\Method\AbstractMethod

public function __construct(
        \MercadoPago\Core\Helper\Data $helperData,
        \Magento\Catalog\Helper\Image $helperImage,
        \Magento\Checkout\Model\Session $checkoutSession,
        \Magento\Customer\Model\Session $customerSession,
        \Magento\Sales\Model\OrderFactory $orderFactory,
        \Magento\Framework\UrlInterface $urlBuilder,
        \Magento\Framework\Model\Context $context,
        \Magento\Framework\Registry $registry,
        \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
        \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory,
        \Magento\Payment\Helper\Data $paymentData,
        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
        \Magento\Payment\Model\Method\Logger $logger,
        \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
        \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
        array $data = []

        $this->_helperData = $helperData;
        $this->_helperImage = $helperImage;

        $this->_checkoutSession = $checkoutSession;

So it should work, i read that it might be a cache problem, i disabled the cache from everywhere in Magento dashboard -> System -> Cache management but still no success.

How can I solve it? I just need to get the quote ID for a SQL query later. Of course without quote, the function getQuoteId() doesn't work. I tried logging the $checkoutSession but it is empty.

Thanks for your time

1 Answer 1


I couldn't solve it, neither know what was the problem.

I "solved" it using $this->_checkoutSession->getLastRealOrderId() which works fine (still don't know why)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.