diff --git a/src/views/OrderDetail.vue b/src/views/OrderDetail.vue index 16e098b..5043143 100644 --- a/src/views/OrderDetail.vue +++ b/src/views/OrderDetail.vue @@ -36,7 +36,7 @@ {{ $t("Pickup") }} {{ getProductStock(item.sku, shopifyStores[0]?.storeCode) }} {{ $t("in stock") }} - + {{ $t("Pre Order") }} @@ -148,9 +148,9 @@ export default defineComponent({ updateDraftOrder () { this.store.dispatch('order/updateDraftOrder', this.order); }, - isPreorderBackorderItem (item: any) { + checkPreorderBackorderItem (item: any) { const property = item.properties?.find((property: any) => property.name === 'Note')?.value; - return !!property; + return property ? property : "" ; }, timeFromNow (time: string) { if (time) { @@ -159,8 +159,12 @@ export default defineComponent({ } }, getEstimatedDeliveryDate(item: any, label: string){ - if(this.isPreorderBackorderItem(item)){ - return item.properties.find((property: any) => property.name === "PROMISE_DATE") ? item.properties.find((property: any) => property.name === "PROMISE_DATE")["PROMISE_DATE"] : ""; + const labelMapping = { + "BACKORDER": "Back Order", + "PRE-ORDER": "Pre Order", + } as any + if(this.checkPreorderBackorderItem(item) === labelMapping[label]) { + return item.properties.find((property: any) => property.name === "PROMISE_DATE") ? item.properties.find((property: any) => property.name === "PROMISE_DATE").value : ""; } const product = this.getPreorderItemAvailability(item.sku); if(product.label === label){