cancel
Showing results for 
Search instead for 
Did you mean: 

Error 404 after delete account

SOLVED

Error 404 after delete account

Hello,

I've a problem with Delete customer action on dashboard.

 

I've that in custom script and call it on my form

public function getDeleteUrl()
    {
        return $this->getUrl('*/*/delete', ['id' => $this->getCustomerId()]);
    }

this is my form

<form class="form-delete-account" action="<?php echo $block->getDeleteUrl(); ?>" method="post">

The url is -> be_fr/customer/account/delete/ and when I submit the form, I'm redirect on 404 error page ...

 

Any idea?

Thank Smiley Happy

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Error 404 after delete account

Hi @JoouulDev

 

could you try this.

 

$customerID = 1;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customer = $objectManager->create('Magento\Customer\Model\Customer')->load($customerID);
if($customer->delete()){

}else{
}

 

 

Problem solved? Click Kudos & Accept as Solution!

 

Thanks

 

if issue solved,Click Kudos & Accept as Solution
Thanks
SelvaKumar

View solution in original post

2 REPLIES 2

Re: Error 404 after delete account

Hi,

The delete action is not available/not called correctly. Can you please check to delete action is available or not in the account controller.

 

Thank you!

Re: Error 404 after delete account

Hi @JoouulDev

 

could you try this.

 

$customerID = 1;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customer = $objectManager->create('Magento\Customer\Model\Customer')->load($customerID);
if($customer->delete()){

}else{
}

 

 

Problem solved? Click Kudos & Accept as Solution!

 

Thanks

 

if issue solved,Click Kudos & Accept as Solution
Thanks
SelvaKumar