Skip to content

Commit 2899aac

Browse files
committed
Fix product Mixin Product level attributes
1 parent 5f7710d commit 2899aac

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

commercetools/commercetools-sdk-java-api/src/main/java/com/commercetools/api/models/product/ProductDataLike.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,6 @@ default Optional<ProductVariant> findVariantBySku(final String sku) {
109109

110110
@Nullable
111111
CategoryOrderHints getCategoryOrderHints();
112+
113+
List<Attribute> getAttributes();
112114
}

commercetools/commercetools-sdk-java-api/src/main/java/com/commercetools/api/models/product/ProductMixin.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
package com.commercetools.api.models.product;
33

4+
import java.util.Collections;
45
import java.util.Optional;
56
import java.util.stream.Collectors;
67

@@ -55,6 +56,9 @@ public static ProductProjection toProjection(final Product template,
5556
.state(StateReference.deepCopy(template.getState()))
5657
.reviewRatingStatistics(ReviewRatingStatistics.deepCopy(template.getReviewRatingStatistics()))
5758
.priceMode(template.getPriceMode())
59+
.attributes(Optional.ofNullable(productDataLike.getAttributes())
60+
.map(a -> a.stream().map(Attribute::deepCopy).collect(Collectors.toList()))
61+
.orElse(Collections.emptyList()))
5862
.build();
5963
}
6064
}

0 commit comments

Comments
 (0)