Merge pull request #22937 from scmmishra/fix-item-configure-13-beta
diff --git a/erpnext/portal/product_configurator/utils.py b/erpnext/portal/product_configurator/utils.py
index f8af30a..9eef16b 100644
--- a/erpnext/portal/product_configurator/utils.py
+++ b/erpnext/portal/product_configurator/utils.py
@@ -239,7 +239,8 @@
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)
+ if product_info:
+ product_info["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:
diff --git a/erpnext/templates/generators/item/item_configure.js b/erpnext/templates/generators/item/item_configure.js
index 163c955..5fd9011 100644
--- a/erpnext/templates/generators/item/item_configure.js
+++ b/erpnext/templates/generators/item/item_configure.js
@@ -193,17 +193,14 @@
filtered_items_count === 1 ?
filtered_items[0] : '';
- // Allow Add to Cart if adding out of stock items enabled in Shopping Cart else check stock.
- const in_stock = product_info.allow_items_not_in_stock ? 1 : product_info.in_stock;
- const add_to_cart = `<a href data-action="btn_add_to_cart" data-item-code="${one_item}">${__('Add to cart')}</a>`;
- const product_action = in_stock ? add_to_cart : `<a style="color:#74808b;">${__('Not in Stock')}</a>`;
-
const item_add_to_cart = one_item ? `
<div class="alert alert-success d-flex justify-content-between align-items-center" role="alert">
<div>
<div>${one_item} ${product_info && product_info.price ? '(' + product_info.price.formatted_price_sales_uom + ')' : ''}</div>
</div>
- ${product_action}
+ <a href data-action="btn_add_to_cart" data-item-code="${one_item}">
+ ${__('Add to cart')}
+ </a>
</div>
`: '';