Gear category does not show in admin, but shows on frontend.
Found this command and want to be sure it is the correct command:
delete from catalog_category_entity where entity_id= category_id;
How do I find out what the category id is?
ran command and got Error
SQL query:
delete from catalog_category_entity where entity_id=3 category_id
MySQL said:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'category_id' at line 1
Solved! Go to Solution.
Hello @Sheba
may be you assign title store wise so switch store wise and check it
regarding to category:-
select * from catalog_category_entity_varchar where value like '%gear%'
select * from catalog_category_entity_text where value like '%gear%'
by using you will find out category id
and run below query
delete from catalog_category_entity where entity_id=3
where 3 will be found from above two query.
if works then mark as a solution.
Hello @Sheba
Please use the below script to remove the category:
<?php use \Magento\Framework\App\Bootstrap; include('app/bootstrap.php'); $bootstrap = Bootstrap::create(BP, $_SERVER); $objectManager = $bootstrap->getObjectManager(); $state = $objectManager->get('\Magento\Framework\App\State'); $state->setAreaCode('frontend'); $rootCat = $objectManager->get('Magento\Catalog\Model\Category'); $cat_info = $rootCat->load(3); //3 is the category ID $cat_info->delete(); echo '<pre>';print_r($cat_info->getData());die('died');
Hope it is helpful.
Hi @Sheba,
The correct query will be :
delete from catalog_category_entity where entity_id=3
Make sure that "3" is the correct category id.
If you are using Flat tables then do the reindex once as well.
php bin/magento indexer:reindex
I hope it will help you!
Hi @Sheba,
The code which shared by @Meetanshi, you can create a new php file on the Magento root folder.
Then you hit that file from browser.
If you want to delete directly from database, then then query which I have shared also work for you.
I hope it will help you!
@Sheba
Have you tried the query which I have shared with you?
delete from catalog_category_entity where entity_id=3
Hello @Sheba
may be you assign title store wise so switch store wise and check it
regarding to category:-
select * from catalog_category_entity_varchar where value like '%gear%'
select * from catalog_category_entity_text where value like '%gear%'
by using you will find out category id
and run below query
delete from catalog_category_entity where entity_id=3
where 3 will be found from above two query.
if works then mark as a solution.