diff --git a/erpnext/e_commerce/variant_selector/utils.py b/erpnext/e_commerce/variant_selector/utils.py
index 1a3e737928..4466c45743 100644
--- a/erpnext/e_commerce/variant_selector/utils.py
+++ b/erpnext/e_commerce/variant_selector/utils.py
@@ -162,6 +162,7 @@ def get_next_attribute_and_values(item_code, selected_attributes):
product_info = get_item_variant_price_dict(exact_match[0], cart_settings)
if product_info:
+ product_info["is_stock_item"] = frappe.get_cached_value("Item", exact_match[0], "is_stock_item")
product_info["allow_items_not_in_stock"] = cint(cart_settings.allow_items_not_in_stock)
else:
product_info = None
diff --git a/erpnext/templates/generators/item/item_configure.js b/erpnext/templates/generators/item/item_configure.js
index 613c967e3d..9beba3fd01 100644
--- a/erpnext/templates/generators/item/item_configure.js
+++ b/erpnext/templates/generators/item/item_configure.js
@@ -219,7 +219,8 @@ class ItemConfigure {
: ''
}
- ${available_qty === 0 ? '(' + __('Out of Stock') + ')' : ''}
+ ${available_qty === 0 && product_info && product_info?.is_stock_item
+ ? '(' + __('Out of Stock') + ')' : ''}
@@ -236,7 +237,8 @@ class ItemConfigure {
`;
/* eslint-disable indent */
- if (!product_info?.allow_items_not_in_stock && available_qty === 0) {
+ if (!product_info?.allow_items_not_in_stock && available_qty === 0
+ && product_info && product_info?.is_stock_item) {
item_add_to_cart = '';
}