0

How can user check the order details when the order is placed as guest. I have tried 'yourdomain.com/sales/guest/form/' but it requires Billing Last name which is not available in case of guest checkout.

Any alternate to get the order details?

Thanks

1 Answer 1

0

You can archive this using

Create form like 'Request Order datail for guest customer' with input box email and call function as per below.

public function __construct(
    \Magento\Sales\Model\ResourceModel\Order\CollectionFactory $orderCollectionFactory,

) {
    $this->orderCollectionFactory = $orderCollectionFactory;
}

public function getGuestOrderCollection()
{
    $post = $this->getRequest()->getPost();
    $Customeremail = $post['email'];

    $orderCollecion = $this->orderCollectionFactory
        ->create()
        ->addFieldToSelect('*');
    $orderCollecion->addAttributeToFilter('customer_email',$Customeremail)
    $orderCollecion->addAttributeToFilter('customer_is_guest', ['eq'=>1]);

    $orderData = $orderCollecion->getData();

    //Get Last Ordered details from $orderData and send order details using mail to guest email

    return $orderCollecion;
}

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.