I would be happy to help.
Use the path of your required page instead of ‘sales/order/history’ in $customUrl variable.
It can be done using the below solution to redirect customer to custom page after login in Magento 2.
So why not redirect them to your latest products, or best sellers or even some offers and discounts that you may be offering in your store at once when they log in!
Feel free to share the method with Magento Community via social media.
Thank you for subscribing.
Method to Redirect Customer to Custom Page after Login in Magento 2
- Use below code in di.xml file at Vendor/Extension/etc/frontend
<?xml version=“1.0”?><config xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”xsi:noNamespaceSchemaLocation=“urn:magento:framework:ObjectManager/etc/config.xsd”><type name=“MagentoCustomerControllerAccountLoginPost”><plugin name=“redirect_custom_url” type=“VendorExtensionPluginRedirectCustomUrl” sortOrder=“1”/></type>
- Paste the below code in RedirectCustomUrl.php file at Vendor/Extension/Plugin
namespace VendorExtensionPlugin;class RedirectCustomUrlpublic function afterExecute(MagentoCustomerControllerAccountLoginPost $subject,$result)$customUrl = ‘sales/order/history’;$result->setPath($customUrl);return $result;
However, not all the default functionalities may be suitable for your modern online store. Fortunately, the Magento CMS is flexible enough to allow the developers to tweak the features and customize them based on the business requirements.
In today’s post, I’ll give the solution for one such similar customization that store owners frequently require.
You can redirect your customers to some appointment page if you have one and your business requires customers to book an appointment. Or, you can simply redirect them to any custom CMS page that you want them to have a look at.
The default Magento 2 redirects a customer to their “My Account” dashboard section or the previous page once they log in to the store.
Never miss Magento tips, tricks, tutorials, and news.
When a customer logs in to your store, it is the prime time when you can redirect their attention to things you want. It is a short time span where you can lure them for engagement or even conversion.
- How to Redirect Customer Login or Registration Success to Checkout in Magento 2
- How to Redirect Customers to The Previous Page After Login in Magento
Get Weekly Updates
If you have any doubt regarding the above solution, do mention them in the Comments section below.
Something went wrong.