Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Docs

Pacu25b8d179b5a61
diff --git a/saleor/product/utils.py b/saleor/product/utils.py
index 34c0ac52ec..954652ad07 100644
--- a/saleor/product/utils.py
+++ b/saleor/product/utils.py
@@ -393,6 +393,14 @@ def get_attributes_display_map(obj, attributes):
def generate_name_from_values(attributes_dict):
+ """Generates name from AttributeChoiceValues. Attributes dict is sorted,
+ as attributes order should be kept within each save.
+
+ Args:
+ attributes_dict: dict of attribute_pk: AttributeChoiceValue values
+ """
return ' / '.join(
- smart_text(attribute_value)
- for attribute_value in sorted(attributes_dict.values()))
+ smart_text(attributechoice_value)
+ for attribute_pk, attributechoice_value in sorted(
+ attributes_dict.items(),
+ key=lambda x: x[0]))