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

@@ -186,7 +186,7 @@ class ItemConfigure {
this.dialog.$status_area.empty();
}
get_html_for_item_found({ filtered_items_count, filtered_items, exact_match, product_info }) {
get_html_for_item_found({ filtered_items_count, filtered_items, exact_match, product_info, allow_items_not_in_stock }) {
const exact_match_message = __('1 exact match.');
const one_item = exact_match.length === 1 ?
exact_match[0] :
@@ -194,7 +194,7 @@ class ItemConfigure {
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 in_stock = allow_items_not_in_stock ? 1 : product_info && 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>`;