fix: allow add to cart for any item if allow_items_not_in_stock is enabled

This commit is contained in:
prssanna
2020-12-08 16:38:16 +05:30
parent b83e131b1f
commit cfb6e3aa30
2 changed files with 5 additions and 3 deletions

View File

@@ -249,6 +249,7 @@ def get_next_attribute_and_values(item_code, selected_attributes):
optional_attributes = item_cache.get_optional_attributes()
exact_match = []
allow_items_not_in_stock = False
# search for exact match if all selected attributes are required attributes
if len(selected_attributes.keys()) >= (len(attribute_list) - len(optional_attributes)):
item_attribute_value_map = item_cache.get_item_attribute_value_map()
@@ -263,7 +264,7 @@ def get_next_attribute_and_values(item_code, selected_attributes):
if exact_match:
data = get_product_info_for_website(exact_match[0])
product_info = data.product_info
product_info["allow_items_not_in_stock"] = cint(data.cart_settings.allow_items_not_in_stock)
allow_items_not_in_stock = cint(data.cart_settings.allow_items_not_in_stock)
if not data.cart_settings.show_price:
product_info = None
else:
@@ -275,6 +276,7 @@ def get_next_attribute_and_values(item_code, selected_attributes):
'filtered_items_count': filtered_items_count,
'filtered_items': filtered_items if filtered_items_count < 10 else [],
'exact_match': exact_match,
'allow_items_not_in_stock': allow_items_not_in_stock,
'product_info': product_info
}