문제

When customer click subscribe to price or stock notification (on product page) then after login, gets redirected to the 404 page.

Any help, experience and knowledge sharing would be appreciated.

올바른 솔루션이 없습니다

다른 팁

I also encountered this issue on 'stock alert' on Magento 2.3.1 CE.

The problem is that upon successful login, Magento tries to get the url (productalert/add/stock/* or productalert/add/price/* respectively).

Since Magento\ProductAlert\Controller\Add\Stock implements HttpPostActionInterface, it returns a 404 (no route found), as HttpPostActionInterface does not allow get requests. This also applies for Magento\ProductAlert\Controller\Add\Price.

You will have to override this controller and remove the implementation of HttpPostActionInterface.

Create controller action by copying the price or stock actions and remove implements. I will be using stock as the example below:

Before:

namespace Magento\ProductAlert\Controller\Add;

...

/**
 * Controller for notifying about stock.
 */
class Stock extends AddController implements HttpPostActionInterface

After:

namespace Vendor\Module\Controller\Add;

...

/**
 * Controller for notifying about stock.
 */
class Stock extends AddController

In your di.xml:

<preference for="Magento\ProductAlert\Controller\Add\Stock" type="Vendor\Module\Controller\Add\Stock" />

Run cache:flush and setup:di:compile once changes are in place.

Good luck!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top