diff --git a/CHANGELOG.md b/CHANGELOG.md index f7540274db..b4b986b05a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Invoking afterCacheInvalidated server hook in a proper moment - @Fifciu (#4176) - Fixed `cart/isVirtualCart` to return `false` when cart is empty - @haelbichalex(#4182) - Use `setProductGallery` in `product/setCurrent` to use logic of the action - @cewald (#4153) +- Use same data format in getConfigurationMatchLevel - @gibkigonzo (#4208) ### Changed / Improved diff --git a/core/modules/catalog/helpers/index.ts b/core/modules/catalog/helpers/index.ts index 0253ac4341..181598c72a 100644 --- a/core/modules/catalog/helpers/index.ts +++ b/core/modules/catalog/helpers/index.ts @@ -55,11 +55,10 @@ const getConfigurationMatchLevel = (configuration, variant): number => { const configProperties = Object.keys(omit(configuration, ['price'])) return configProperties .map(configProperty => { - const filter = configuration[configProperty] - const configurationId = filter && isObject(filter) && filter.id const variantPropertyId = variant[configProperty] - return (configurationId && variantPropertyId) && - (toString(configurationId) === toString(variantPropertyId)) + return [].concat(configuration[configProperty]) + .map((f) => toString(f.id)) + .includes(variantPropertyId) }) .filter(Boolean) .length