fix: handle product_info null

This commit is contained in:
Shivam Mishra 2020-08-06 17:08:14 +05:30
parent a91acb62df
commit aa4f8cf4fc

View File

@ -194,9 +194,16 @@ 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 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>`;
var in_stock;
var add_to_cart;
var product_action;
if (product_info) {
in_stock = product_info.allow_items_not_in_stock ? 1 : product_info.in_stock;
add_to_cart = `<a href data-action="btn_add_to_cart" data-item-code="${one_item}">${__('Add to cart')}</a>`;
product_action = in_stock ? add_to_cart : `<a style="color:#74808b;">${__('Not in Stock')}</a>`;
} else {
product_info = '';
}
const item_add_to_cart = one_item ? `
<div class="alert alert-success d-flex justify-content-between align-items-center" role="alert">