I am using a custom module, where I want to redirect to checkout page once a product is adding to cart. For this I have created an event on frontend "checkout_cart_add_product_complete".
For simple product its working fine. But where I am adding a configurable product it will redirect to checkout page with attribute data so(Check in last for URL reference), I am getting an error of noroute on checkout.
Here is my Observer code:
$observer->getRequest()->setParam('return_url', $this->_url->getUrl('checkout'));
My error on checkout page because url become like:- www.yourDomain.com/checkout/#size=173&color=53
Note: Using Magento 2.3