Working with client’s projects get us through lots of new challenges, requirements, implementations and ultimately outperform for the successful project completion. Recently working with such a client, we got a requirement to redirect customers to the previous page from one page checkout. For implementation, we develop custom code which helped to fulfill the requirement.
Custom code to Redirect to Previous Page URL in Magento 2
1 2 3 4 5 6 7 |
jQuery("[selector]").click(function(e) { <!--?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $request = $objectManager->get('Magento\Framework\App\Request\Http'); ?--> window.location.href = '<!--?php echo $request->getServer('HTTP_REFERER'); ?-->'; }); |
Click to rate this post!
[Total: 13 Average: 3.6]