I have complete category path like Default Category/Men/Sale
. How to get category id using it?
Magento 2 – How to Get Category ID by Category Path
categorymagento2
categorymagento2
I have complete category path like Default Category/Men/Sale
. How to get category id using it?
Best Answer
Already a similar code is implemented in catalog import module. You can explore the class
Magento\CatalogImportExport\Model\Import\Product\CategoryProcessor
to learn more about it.Here is my custom code which gives the category id from fully specified category path
Default Category/Men/Sale/Activewear
.