Hello newbie developer here.

Currently I have made a module that will show a list of stores, with this list you can add, edit, save, and delete. My issue at the moment is that I cant get the store to delete. I have tried using repository, collection, and resourceModel but so far I cannot get the store to delete. I get no errors and after runnig bin/magento s:up and deleting store it runs perfectly but WITHOUT deleting the store. What can cause this?

Delete function:

public function deleteById(string $storeId): void
        $store = $this->get($storeId);
        if ($store->getStoreId() === null) {
            throw new NoSuchEntityException(__('There is no Store to Delete with such ID'));


Delete action:

  /** @var Redirect $resultRedirect */
        $resultRedirect = $this->resultRedirectFactory->create();

        $id = $this->getRequest()->getParam(StoreInterface::STORE_ID);

        if (!$id) {
            $this->messageManager->addErrorMessage(__('We can\'t find a Store to delete.'));

            return $resultRedirect->setPath('*/*/');
        $this->messageManager->addSuccessMessage(__('You deleted the Store.'));

        return $resultRedirect->setPath('*/*/');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.