diff --git a/CHANGELOG.md b/CHANGELOG.md index c972c00301..960963d78c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed Search product fails for category filter when categoryId is string - @adityasharma7 (#3929) - Revert init filters in Vue app - @gibkigonzo (#3929) +- All categories disappearing if you add the child category name to includeFields - @1070rik (#4015) - Fix overlapping text in PersonalDetails component - @jakubmakielkowski (#4024) - Redirect from checkout to home with a proper store code - @Fifciu diff --git a/core/modules/catalog/helpers/slugifyCategories.ts b/core/modules/catalog/helpers/slugifyCategories.ts index 73266fb8dc..d8ac615236 100644 --- a/core/modules/catalog/helpers/slugifyCategories.ts +++ b/core/modules/catalog/helpers/slugifyCategories.ts @@ -20,11 +20,13 @@ const createSlug = (category: ChildrenData): string => { const slugifyCategories = (category: Category | ChildrenData): Category | ChildrenData => { if (category.children_data) { - for (let subcat of category.children_data) { - if (subcat.name) { - return slugifyCategories({ ...subcat, slug: createSlug(subcat) } as any as ChildrenData) + category.children_data.forEach((subCat: ChildrenData): void => { + if (subCat.name) { + subCat.slug = createSlug(subCat) } - } + + slugifyCategories(subCat) + }) } return category