File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
WooCommerce/Classes/ViewRelated/Products/Variations Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -5,17 +5,21 @@ import Yosemite
55///
66struct ProductVariationGenerator {
77
8- /// Group a colection of attribute options.
8+ /// Group a collection of attribute options.
99 /// EG: [Size: Large, Color: Black, Fabric: Cotton]
1010 ///
11- private struct Combination : Hashable {
11+ private struct Combination : Hashable , Equatable {
1212 let options : [ Option ]
13+
14+ static func == ( lhs: Combination , rhs: Combination ) -> Bool {
15+ Set ( lhs. options) == Set ( rhs. options)
16+ }
1317 }
1418
1519 /// Represents an attribute option.
1620 /// EG: Size: Large
1721 ///
18- private struct Option : Hashable {
22+ private struct Option : Hashable , Equatable {
1923 let attributeID : Int64
2024 let attributeName : String
2125 let value : String
@@ -56,10 +60,10 @@ struct ProductVariationGenerator {
5660 }
5761
5862 // Filter existing combinations.
59- let existingSet = Set ( existingCombinations)
60- return combinations. filter { combination in
61- !existingSet. contains ( combination)
63+ let unique = combinations. filter { combination in
64+ !existingCombinations. contains ( combination)
6265 }
66+ return unique
6367 }
6468
6569 /// Convert the provided combinations into `[CreateProductVariation]` types that are consumed by our Yosemite stores.
You can’t perform that action at this time.
0 commit comments