1

I have a custom module that works with the default Magento quote factory. Here, I am fetching the quote data using the,

\Magento\Quote\Model\QuoteFactory $quoteFactory

In my controller, I am trying to get the quote details using my quote id as below,

$quote = $this->quoteFactory->create()->load($quoteId);
        $subTotal = $quote['subtotal'];
        $total = $quote['grand_total'];

This is working as expected, however in case where magento is having multiple store views, the above is returning empty values. The above code is working fine and the quote details are returning properly only in the Default Store View but not in other store views.

Note that the we are getting the quote id in all the store views but the quote is empty.

Is there anything else that I should do to get the quote details in other store views as well.

Please can anyone help?

1

I know I am late in answering this, however I will still go for it in case it may help someone else.

Please replace below code for getting the quotes,

$quote = $this->quoteFactory->create()->load($quoteId);

to

$quote =$this->quoteFactory->create()->loadByIdWithoutStore($quoteId);

This will load the quotes without considering the stores.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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