Passing any relation to expand for the storefront products/ API endpoint appears to drop custom_attributes from the response data. Should the inclusion of attribute relations in defaultStoreProductsRelations mean they're always returned?
I've worked around this by handling custom_attributes passed in as a relation to expand:
async listAndCount(
selector: ProductSelector & {
attributes: string[];
int_attributes: IntAttributeParam;
},
config: FindProductConfig = {
relations: [],
skip: 0,
take: 20,
include_discount_prices: false,
}
): Promise<[Product[], number]> {
const manager = this.activeManager_;
const productRepo = manager.withRepository(this.productRepository_);
if (config.relations?.includes("custom_attributes")) {
config.relations.push(
"attribute_values",
"attribute_values.attribute",
"int_attribute_values",
"int_attribute_values.attribute",
)
config.relations = config.relations.filter(rel => rel !== "custom_attributes");
}
Passing any relation to expand for the storefront products/ API endpoint appears to drop custom_attributes from the response data. Should the inclusion of attribute relations in defaultStoreProductsRelations mean they're always returned?
I've worked around this by handling custom_attributes passed in as a relation to expand: