0

After placing an order the Customer's Account shows

You have placed no orders. and shopping carts and wish lists. it gone?

Please Help

enter image description here

Backend

enter image description here

Thanks

10
  • Check debug.log, system.log, exception.log. Are you getting any helpful information?
    – user55548
    Feb 28, 2020 at 5:21
  • 2
    In database table named 'sales_order_status_state' . Make sure its visible_on_frontend is valued 1
    – Mr Zid
    Feb 28, 2020 at 5:24
  • @MrZid Ok wait sir i will check and update ty
    – DK Thakur
    Feb 28, 2020 at 5:25
  • @MrZid Please check This prnt.sc/r8tngb
    – DK Thakur
    Feb 28, 2020 at 5:27
  • 1
    Open order from the backend and check the Customer Group. It shouldn't be NOT LOGGED IN.
    – Mr Zid
    Feb 28, 2020 at 5:41

2 Answers 2

3
  1. You may have ordered as a NOT lOGGED IN user
  2. Check if customer_id is NULL in table sales_order for your corresponding order

In case if You have ordered after logged in, then your customer Id is not storing in the DB Then you need to try this

$data = \Magento\Framework\App\ObjectManager::getInstance();
$customerSession = $data->create('Magento\Customer\Model\Session');
if($customerSession->isLoggedIn()) {
    $customerId = $customerSession->getCustomer()->getId();
}
0

Check in the admin that the order has a status, and that that status is set to be visible in the table: sales_order_status_state

(I know this question has been answered and accepted, but had the same problem today, except that the orders created using a certain payment method did not have a status set, and hence did not display for the customer on the frontend.)

If that still doesn't solve the problem, I'd recommend looking at the getRecentOrders() function in Magento\Sales\Block\Order\Recent which does joining and filtering. Below for reference:

   private function getRecentOrders()
{
    $orders = $this->_orderCollectionFactory->create()->addAttributeToSelect(
        '*'
    )->addAttributeToFilter(
        'customer_id',
        $this->_customerSession->getCustomerId()
    )->addAttributeToFilter(
        'store_id',
        $this->storeManager->getStore()->getId()
    )->addAttributeToFilter(
        'status',
        ['in' => $this->_orderConfig->getVisibleOnFrontStatuses()]
    )->addAttributeToSort(
        'created_at',
        'desc'
    )->setPageSize(
        self::ORDER_LIMIT
    )->load();
    $this->setOrders($orders);
}

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.