Espresso Martini | Woolworths (2024)

` ) }, 3000) }) } // OTP APIs function executeOtpAPI(preferredChannel) { if (!useTestAPI) { return getOtpAPI(preferredChannel); } else { return testGetOtpAPI(preferredChannel); } } function getOtpAPI(preferredChannel) { return new Promise(function(resolve, reject) { $.ajax({ url: `https://www.woolworths.com.au/api/v3/ui/authentication/otp?isInitial=true&Channel=${preferredChannel}`, type: 'GET', contentType: 'application/json', }).then(res => { if (res.Successful) { resolve(res); } else { reject(res); } }) }); } // send new code / send SMS/Email instead api function testGetOtpAPI(preferredChannel) { console.log('testGetOtpAPI preferredChannel', preferredChannel) if (preferredChannel == 1) { return new Promise((resolve, reject) => { setTimeout(() => { resolve({ "Successful": true, "Channel": 1, "MaskedContact": "p****h@g****.com" }) }, 3000) }) } else { return new Promise((resolve, reject) => { setTimeout(() => { resolve({ "Successful": true, "Channel": 0, "MaskedContact": "*******927" }) }, 3000) }) } } function executeVerifyOtp(otpInputValue) { if (!useTestAPI) { return verifyOtp(otpInputValue); } else { return testVerifyOtp(otpInputValue); } } // Verify the OPT provided by the user function verifyOtp(otpInputValue) { return new Promise(function(resolve, reject) { $.ajax({ url: `https://www.woolworths.com.au/api/v3/ui/authentication/otp`, type: 'POST', contentType: 'application/json', data: JSON.stringify({ OneTimePin: otpInputValue, UpdatePrimaryContact: false }) }).done((res) => { if (res.Successful) { resolve(res); } else { reject(res); } }).fail((res) => { reject(res); }) }); } function testVerifyOtp(otpInputValue) { if (otpInputValue == "123123") { return testOtpSuccess(); } else if (otpInputValue == "000000") { return testApiFailed(); } else { return testWrongOtpCode(); } } function testOtpSuccess() { return new Promise((resolve, reject) => { setTimeout(() => { resolve({ "Successful": true, "Error": null, "TokenValue": "d5794417cf1d4d5385c8347d8960ca07", "ErrorMessage": null }) }, 3000) }) } // wrong otp code function testWrongOtpCode() { console.log('testWrongOtpCode') return new Promise((resolve, reject) => { setTimeout(() => { reject({ "Successful": false, "Error": "InvalidOneTimePin", "TokenValue": "", "ErrorMessage": "Incorrect code. You have 4 attempt(s) left." }) }, 3000) }) } function fetchOrders(shopperId) { if (!useTestAPI) { return getOrdersAPI(shopperId); } else { return testGetOrdersAPI(); // return testNoOrdersAPI(); } } function getOrdersAPI(shopperId) { return new Promise(function(resolve, reject) { $.ajax({ url: `https://prod.mobile-api.woolworths.com.au/wow/v1/orders/api/orders?shopperId=${shopperId}&pageNumber=1&pageSize=6`, type: 'GET', contentType: 'application/json', headers: { "x-api-key": "s7iXf5Rixn4XxFrsYh4HKkriVp8hlnec" }, xhrFields: { withCredentials: true }, crossDomain: true }).done((res) => { resolve(res); }).fail((res) => { reject(res); }) }); } // orderstatus = // "Placed", "Received", "Preparing", // "Prepared", "OnItsWay", "Delivered", // "Shipped", "PartiallySent", "Cancelled" let testOrderStatus = "PartiallySent"; // DeliveryMethod = "Courier", "Express", "Pickup", "DriveUp" let testDeliveryMethod = "DriveUp"; function testGetOrdersAPI() { return new Promise((resolve, reject) => { setTimeout(() => { resolve({ "items": [{ "OrderId": 148153401, "CreatedDate": "2023-01-30T18:20:33.586949+11:00", "OriginalOrderCreatedDate": "2023-01-30T18:20:33.586949+11:00", "Total": 69.5, "CurrentStatus": `${testOrderStatus}`, "DeliveryMethod": `${testDeliveryMethod}`, "ProjectedDeliveryTime": { "Status": "OnTime", "OriginalStartTime": "2023-02-05T12:00:00", "OriginalEndTime": "2023-02-05T17:00:00", "StartTime": "2023-02-05T12:00:00", "EndTime": "2023-02-05T17:00:00", "BufferType": "None" }, "IsPfdOrder": false, "OrderType": "Standard", "MarketOrders": [], "IsMarketOnly": false, "IsPostPickPayOrder": false, "IsThirdPartyDelivery": false }, { "OrderId": 148153402, "CreatedDate": "2023-01-30T18:20:33.586949+11:00", "OriginalOrderCreatedDate": "2023-01-30T18:20:33.586949+11:00", "Total": 69.5, "CurrentStatus": `${testOrderStatus}`, "DeliveryMethod": `${testDeliveryMethod}`, "ProjectedDeliveryTime": { "Status": "OnTime", "OriginalStartTime": "2023-02-05T12:00:00", "OriginalEndTime": "2023-02-05T17:00:00", "StartTime": "2023-02-05T12:00:00", "EndTime": "2023-02-05T17:00:00", "BufferType": "None" }, "IsPfdOrder": false, "OrderType": "Standard", "MarketOrders": [], "IsMarketOnly": false, "IsPostPickPayOrder": false, "IsThirdPartyDelivery": false }, { "OrderId": 148153403, "CreatedDate": "2023-01-30T18:20:33.586949+11:00", "OriginalOrderCreatedDate": "2023-01-30T18:20:33.586949+11:00", "Total": 69.5, "CurrentStatus": `${testOrderStatus}`, "DeliveryMethod": `${testDeliveryMethod}`, "ProjectedDeliveryTime": { "Status": "OnTime", "OriginalStartTime": "2023-02-05T12:00:00", "OriginalEndTime": "2023-02-05T17:00:00", "StartTime": "2023-02-05T12:00:00", "EndTime": "2023-02-05T17:00:00", "BufferType": "None" }, "IsPfdOrder": false, "OrderType": "Standard", "MarketOrders": [], "IsMarketOnly": false, "IsPostPickPayOrder": false, "IsThirdPartyDelivery": false } ], "_links": { "self": "/api/Orders?shopperId=4282500&pageNumber=1&pageSize=6", "next": "/api/Orders?shopperId=4282500&pageNumber=2&pageSize=6", "previous": "/api/Orders?shopperId=4282500&pageNumber=1&pageSize=6" } }) }, 1500) }) } function testNoOrdersAPI() { return new Promise((resolve, reject) => { setTimeout(() => { resolve({ "items": [], "_links": { "self": "/api/Orders?shopperId=4282500&pageNumber=1&pageSize=6", "next": "/api/Orders?shopperId=4282500&pageNumber=2&pageSize=6", "previous": "/api/Orders?shopperId=4282500&pageNumber=1&pageSize=6" } }) }, 3000) }) } function fetchOrderDetails(orderId) { if (!useTestAPI) { return getOrderDetails(orderId); } else { return testGetOrderDetails(); } } function getOrderDetails(orderId) { return new Promise(function(resolve, reject) { $.ajax({ url: `https://prod.mobile-api.woolworths.com.au/wow/v1/orders/api/orders/${orderId}`, type: 'GET', contentType: 'application/json', headers: { "x-api-key": "s7iXf5Rixn4XxFrsYh4HKkriVp8hlnec" }, xhrFields: { withCredentials: true }, crossDomain: true }).done((res) => { resolve(res); }).fail((res) => { reject(res); }) }); } function testGetOrderDetails() { return new Promise((resolve, reject) => { setTimeout(() => { resolve({ "DeliveryWindowId": 628988, "DeliveryInstructions": "", "CanLeaveOrderUnattended": false, "ContainsFrozen": true, "ContainsRestrictedBySignature": false, "ContainsRestrictedBySignatureAndPhotoId": false, "DeliveryStreet1": "20 Bridge St", "DeliveryStreet2": "EPPING NSW", "DeliverySuburb": "Epping", "DeliveryPostCode": "2121", "OrderProducts": [{ "Ordered": { "StockCode": 175905, "Brand": "Woolworths", "Name": "Woolworths 12 Extra Large Free Range Eggs", "Quantity": 5, "Total": 26, "TotalExcludingGst": 0, "ListPrice": { "Measure": "Each", "Value": 5.2 }, "SalePrice": { "Measure": "Each", "Value": 5.2 }, "ComparativePrice": { "Measure": "100G", "Value": 0.74 }, "AllowSubstitution": true, "LineNumber": 1, "IsPurchasableWithRewardsCredits": false, "IsGiftable": false, "IsNotSelfServiceReturnable": false } }, { "Ordered": { "StockCode": 463666, "Brand": "Chobani", "Name": "Chobani Plain Whole Milk Greek Yogurt", "Quantity": 1, "Total": 7, "TotalExcludingGst": 0, "ListPrice": { "Measure": "Each", "Value": 7 }, "SalePrice": { "Measure": "Each", "Value": 7 }, "ComparativePrice": { "Measure": "100G", "Value": 0.77 }, "AllowSubstitution": true, "LineNumber": 2, "IsPurchasableWithRewardsCredits": false, "IsGiftable": false, "IsNotSelfServiceReturnable": false } }, { "Ordered": { "StockCode": 117381, "Brand": "Macro", "Name": "Macro Organic Carrots", "Quantity": 1, "Total": 4.5, "TotalExcludingGst": 0, "ListPrice": { "Measure": "Each", "Value": 4.5 }, "SalePrice": { "Measure": "Each", "Value": 4.5 }, "ComparativePrice": { "Measure": "1KG", "Value": 6 }, "AllowSubstitution": true, "LineNumber": 3, "IsPurchasableWithRewardsCredits": false, "IsGiftable": false, "IsNotSelfServiceReturnable": false } }, { "Ordered": { "StockCode": 785977, "Brand": "Nong Shim", "Name": "Nong Shim Shin Ramyun", "Quantity": 4, "Total": 18, "TotalExcludingGst": 0, "ListPrice": { "Measure": "Each", "Value": 7 }, "SalePrice": { "Measure": "Each", "Value": 4.5 }, "ComparativePrice": { "Measure": "100G", "Value": 0.75 }, "AllowSubstitution": true, "LineNumber": 4, "IsPurchasableWithRewardsCredits": false, "IsGiftable": false, "IsNotSelfServiceReturnable": false } } ], "OrderDiscountDetailsList": [], "PaymentDetails": { "MarketTotalByVendor": {}, "TotalBeforeSavings": 65.5, "Savings": 10, "Subtotal": 55.5, "OrderDiscount": 0, "DeliveryFeeBeforeDiscount": 13, "DeliveryFeeDiscount": 0, "DeliveryFee": 13, "MarketShippingFee": 0, "MarketShippingFeeBeforeDiscount": 0, "MarketShippingFeeDiscount": 0, "MarketSellerShippingFees": [], "Total": 69.5, "AdditionalDeductions": 0, "AmountToPay": 69.5, "PaidBy": [{ "Type": "CreditCard", "Amount": 69.5 }], "WowTotal": 69.5, "CompleteTotal": 69.5, "MarketplaceTotal": 0, "MarketplaceSubtotal": 0, "WowSubtotal": 55.5, "TeamDiscount": 0, "OrderDiscountWithoutTeamDiscount": 0, "PackagingFeeBeforeDiscount": 1, "PackagingFeeDiscount": 0, "PackagingFee": 1, "PackagingFeeLabel": "Reusable bags", "MarketDeliveryFee": 0 }, "RewardsPointsToCollect": 56, "RewardsCreditsToCollect": 0, "RewardsCreditsRedeemed": 0, "IsRewardsEarningsAvailable": true, "FulfilmentStore": { "Id": 8881, "Name": "Lidcombe CFC", "Timezone": "AUS Eastern Standard Time", "Url": "", "PhoneNumber": "", "Street1": "6 Hill Road", "Street2": "", "Area": "8881 Lidcombe CFC LOCAL", "PostCode": "2141", "Suburb": "Lidcombe Place Holder Suburb", "State": "" }, "RewardsCardNumber": "9355130014696", "IsRedelivery": false, "AmendmentCutOffStoreTime": "2023-02-05T00:45:00+11:00", "HasMarketOrderGiftingDetails": false, "DeliveryDelayed": false, "OrderId": 148153401, "CreatedDate": "2023-01-30T18:20:33.586949+11:00", "OriginalOrderCreatedDate": "2023-01-30T18:20:33.586949+11:00", "Total": 69.5, "CurrentStatus": `${testOrderStatus}`, "DeliveryMethod": `${testDeliveryMethod}`, "ProjectedDeliveryTime": { "Status": "OnTime", "OriginalStartTime": "2023-02-05T12:00:00", "OriginalEndTime": "2023-02-05T17:00:00", "StartTime": "2023-02-05T12:00:00", "EndTime": "2023-02-05T17:00:00", "BufferType": "None" }, "IsPfdOrder": false, "OrderType": "Standard", "MarketOrders": [], "IsMarketOnly": false, "GroceriesOrderId": 148153401, "IsPostPickPayOrder": false, "IsThirdPartyDelivery": false } ) }, 1500) }) } function fetchEdrCard() { if (!useTestAPI) { return getEdrCard(); } else { return testGetEdrCard(); // return testNoEdrCard(); } } function getEdrCard() { return new Promise(function(resolve, reject) { $.ajax({ url: `https://www.woolworths.com.au/apis/ui/EdrCard`, type: 'GET', contentType: 'application/json' }).done((res) => { resolve(res); }).fail((res) => { reject(res); }) }); } function testGetEdrCard() { return new Promise((resolve, reject) => { setTimeout(() => { resolve({ "NoValidEdrCardMessage": null, "HasValidAndRegisteredEdrCardMessage": "Your Woolworths Rewards cards has been accepted.", "HasValidAndUnRegisteredEdrCardMessage": null, "IsStaffMemberMessage": null, "CardValidationResult": "NotApplicable", "CardNumber": "9355130014696", "Isprimary": true, "Password": null, "Status": "Registered", "ShopperId": 4282500, "ValidatePassword": true, "Crn": "" }) }, 3000) }) } function testNoEdrCard() { return new Promise((resolve, reject) => { setTimeout(() => { resolve({}) }, 3000) }) } function fetchEdrCardBalance(cardNumber) { if (!useTestAPI) { return getEdrCardBalance(cardNumber); } else { return testEdrCardBalance(); } } function getEdrCardBalance(cardNumber) { return new Promise(function(resolve, reject) { $.ajax({ url: `https://www.woolworths.com.au/apis/ui/EdrCard/BalanceSummary?cardNumber=${cardNumber}`, type: 'GET', contentType: 'application/json' }).done((res) => { resolve(res); }).fail((res) => { reject(res); }) }); } let testEdrBalance = 1622; function testEdrCardBalance() { return new Promise((resolve, reject) => { setTimeout(() => { resolve({ "SaveForLaterPreference": { "Preference": "Automatic", "QffPoints": null, "PayOutDate": null, "RoundedCurrentVoucherBalance": 0, "IsLessThanMinimumBalance": false }, "Response": { "IsError": false, "Result": { "ReturnCode": "0", "ErrorMessage": "" }, "ReturnCode": "Success", "LifeTimeEarn": "1", "LifeTimeRedeem": "0", "CurrentPointBalance": `${testEdrBalance}`, "CurrentVoucherBalance": "0", "NextVoucherExpiry": "2023-02-01", "QffVoucherBalance": null, "LifeTimeCreditEarn": "3", "LifeTimeCreditRedeem": "0", "CurrentCreditBalance": "3", "ErrorMessage": null }, "LifeTimeEarn": 1, "LifeTimeRedeem": 0, "CurrentPointBalance": testEdrBalance, "CurrentVoucherBalance": 0, "NextVoucherExpiry": null, "LifeTimeCreditEarn": 3, "LifeTimeCreditRedeem": 0, "CurrentCreditBalance": 3, "IsError": false, "ErrorMessage": null, "DisplayErrorMessage": null }) }, 1000) }) } // show and hide password when clicking on the eye $(".password-with-eye").click(function() { if ($(this).parent(".password-textbox").find("input").attr("type") == "password") { $(this).parent(".password-textbox").find("input").attr("type", "text"); $(this).find("i").removeClass("iconAct-Visibility_Off").addClass("iconAct-Visibility"); } else { $(this).parent(".password-textbox").find("input").attr("type", "password"); $(this).find("i").removeClass("iconAct-Visibility").addClass("iconAct-Visibility_Off"); } });

Espresso Martini | Woolworths (1)

# ${orderId}.

Order Status

${orderStatus}.

Fulfilment method

${fulfilmentMethod} .

Order date

${orderDate} .

Action 1 is

Track Order

Action 2 is

` ); if(orderStatus !== "Cancelled") { fetchOrderDetails(orderId).then(res => { let amendmentCutOffStoreTime = res.AmendmentCutOffStoreTime ? res.AmendmentCutOffStoreTime : ""; if(amendmentCutOffStoreTime) { amendOrderByDateTime = moment(amendmentCutOffStoreTime).format( 'LT [on] dddd, D MMM'); // logic if order pickup has expired let ammendHtml = ""; // check if the cutoff date is before current date if(moment(amendmentCutOffStoreTime).isBefore(moment())) { let projectedDeliveryStartTime = order.ProjectedDeliveryTime.StartTime ? moment(order.ProjectedDeliveryTime.StartTime).format('LT') : ""; let projectedDeliveryEndTime = order.ProjectedDeliveryTime.EndTime ? moment(order.ProjectedDeliveryTime.EndTime).format('LT') : ""; amendHtml = `

Estimated between ${projectedDeliveryStartTime} - ${projectedDeliveryEndTime} .
`; }else { amendHtml = `

You may

Make changes up until ${amendOrderByDateTime} .
`; // append the change my order widget if before the cutoff time $('.item__action-panel').append(` Change my order `) } $(`.lux-order-item[data-order-id="${orderId}"] .lux-order-middle-section`) .append(amendHtml); } }); } else if (order.ProjectedDeliveryTime && order.ProjectedDeliveryTime.StartTime && order.ProjectedDeliveryTime.EndTime) { let projectedDeliveryStartTime = order.ProjectedDeliveryTime.StartTime ? moment(order.ProjectedDeliveryTime.StartTime).format('LT') : ""; let projectedDeliveryEndTime = order.ProjectedDeliveryTime.EndTime ? moment(order.ProjectedDeliveryTime.EndTime).format('LT') : ""; let amendHtml = `

Delivery Window

Estimated between ${projectedDeliveryStartTime} - ${projectedDeliveryEndTime} .
`; $(`.lux-order-item[data-order-id="${orderId}"] .lux-order-middle-section`) .append(amendHtml); } if(isMultiOrder) { // update orders section title to display no. of orders $('.lux-my-orders-title').html(`My orders (${orderList.length})`); // set left pos value for order card posValue = posValue + posShiftValue + 20; //20px gap between order cards // set the dots for order card carousel $('.my-orders-indicator').append(`

`); } if(orderList.length == index) { isOrderCardSetupDone = true; } }); if(isMultiOrder && isOrderCardSetupDone) { // update orders section title to display no. of orders $('.lux-my-orders-title').html(`My orders (${orderList.length})`); } } else { // replace loading orders container with no orders container $('.my-orders.loading').replaceWith( `

You currently have no orders to display.
` ); } }) .catch(err => { console.log('error loading orders', err); }); } } function getOrderStatusClass(orderStatus) { switch(orderStatus) { case "Placed": return "placed"; case "Received": return "received"; case "Preparing": return "preparing"; case "OnItsWay": return "in-transit"; case "Delivered": case "Shipped": return "completed"; case "Cancelled": return "cancelled"; case "PartiallySent": return "partiallySent"; default: return "other"; } } function getOrderStatusText(orderStatus, fulfilmentMethod) { switch(orderStatus) { case "Received": return "Order received"; case "Preparing": return "Preparing order"; case "Prepared": switch (fulfilmentMethod) { case "Pick up": return "Ready for Pick up"; case "Direct to boot": return "Ready"; default: return "Preparing order"; } case "OnItsWay": return "On its way"; case "Delivered": return "Delivered"; case "PickedUp": return "Picked up"; case "Shipped": return "Shipped"; case "Cancelled": return "Cancelled"; case "PartiallySent": return "Partially shipped"; default: return ""; } } function getFulfilmentMethodText(fulfilmentMethod) { switch(fulfilmentMethod) { case "Pickup": return "Pick up"; case "DriveUp": return "Direct to boot"; default: // "Courier" || "Express" return "Delivery"; } } $('body').on('click', '.lux-orders-paginate-left-btn', function() { shiftOrders('right'); updateActiveCarouselDot('right'); enableDisableOrderCarouselButton(); }) $('body').on('click', '.lux-orders-paginate-right-btn', function() { shiftOrders('left'); updateActiveCarouselDot('left'); enableDisableOrderCarouselButton(); }) function shiftOrders(direction /* left, right */) { $('.lux-order-item').each((index, item) => { let currentPosValue = $(item).css('left'); let newPosValue = direction == 'left' ? parseInt(currentPosValue, 10) - posShiftValue : parseInt(currentPosValue, 10) + posShiftValue; $(item).css("left", `${newPosValue}px`); }) } let currentActiveDotIndex = 0; function updateActiveCarouselDot(direction /* left, right */) { $('.my-orders-indicator .dot').removeClass('active'); currentActiveDotIndex = direction == 'left' ? currentActiveDotIndex + 1 : currentActiveDotIndex - 1; $(`.my-orders-indicator .dot:nth-child(${currentActiveDotIndex + 1})`).addClass('active'); } function enableDisableOrderCarouselButton () { if(currentActiveDotIndex == 0) { $('.lux-orders-paginate-left-btn').prop('disabled', true); } else { $('.lux-orders-paginate-left-btn').prop('disabled', false); } if (currentActiveDotIndex == $('.lux-order-item').length - 1) { $('.lux-orders-paginate-right-btn').prop('disabled', true); } else { $('.lux-orders-paginate-right-btn').prop('disabled', false); } } // END: LOGGED IN USER PANEL FUNCTIONS

${errorMessage}

` $(errorHTML).insertAfter("#page2 .find-delivery h4.tab-heading"); } }) } function deliveryAddressUpdateFulfilment(selectedAddressId) { $.ajax({ url: `${url}/ui/Fulfilment`, type: 'POST', data: { "addressId": selectedAddressId, "fulfilmentMethod": "Courier" } }).then(() => { getCustomerInfoAsync().then((res) => { totalData = res updateDeliveryTimeDisplay() updateDeliveryMethod() openDeliveryPickupSidePanel() }) }) } // open pick time for delivery side panel function openDeliveryPickupSidePanel() { $('.open-side.time-to').first().click() } // manual delivery address entry $('body').on('click', '.addressSelector-enterManually', function(e) { e.preventDefault() $('.delivery-warning').addClass('hide') showManualDeliveryAdressInput() }) function showManualDeliveryAdressInput() { $('.find-delivery').hide() $('#auto-delivery-buttons-container').hide() $('#manual-delivery-search').show() $('#manual-delivery-buttons-container').show() $('.previous-add').hide() $('#page2').addClass('manual') $('#page2').removeClass('auto') } function hideManualDeliveryAdressInput() { $('.find-delivery').show() $('#auto-delivery-buttons-container').show() $('#manual-delivery-search').hide() $('#manual-delivery-buttons-container').hide() $('#page2').removeClass('manual') $('#page2').addClass('auto') if (previousAddresses) { $('.find-delivery').hide() $('.previous-delivery, .add-address-button').show() $('.previous-add').hide() } } // button to return to auto delivery search from manual delivery search $('#manual-delivery-buttons-container .linkButton.fulfilment-button').click(function(e) { e.preventDefault() hideManualDeliveryAdressInput() }) // add class to input boxes on input so labels stay small if they hhave text $('#shared-text-input-11, #shared-text-input-12, input[name="Postcode"]').on('input', function() { let text = $(this).val() if (text.length) { $(this).addClass('input-with-value') } if (!text.length) { $(this).removeClass('input-with-value') } }) // retrieve the suburbs for the select when you input a postcode for manual delivery search $('input[name="Postcode"]').on('input', function() { let postcode = $(this).val() $('shared-dropdown[name="Suburb"] select').empty() if (postcode.length >= 4) { retrieveSuburbsFromPostCode(postcode).then((res) => { res.Response.forEach(option => { $('shared-dropdown[name="Suburb"] select').append( `` ) }) }) } else { $('shared-dropdown[name="Suburb"] select').append( `` ) } }) function retrieveSuburbsFromPostCode(postcode) { return $.ajax({ url: `${url}/ui/address/suburb/${postcode}`, type: 'GET' }) } // remove validation messages on input to input fields for manual delivery $('shared-textbox[name="Street1"]').on('input', function() { $(this).find('shared-validation-messages').hide() // if this has text then add class let text = $(this).find('input').val() if (text.length) { $(this).addClass('input-with-value') } else { $(this).removeClass('input-with-value') } }) $('shared-dropdown[name="Suburb"], shared-textbox[name="Postcode"]').on('input', function() { $('shared-dropdown[name="Suburb"]').find('shared-validation-messages').hide() $('shared-textbox[name="Postcode"]').find('shared-validation-messages').hide() }) // submit manual delivery search form function manual_delivery() { let form = $('#page2.manual') $(form).find('shared-validation-messages').hide() $(form).find('shared-dropdown[name="Suburb"]').removeClass('ng-invalid') $(form).find('shared-textbox[name="Postcode"]').removeClass('ng-invalid') $(form).find('shared-textbox[name="Street1"]').removeClass('ng-invalid') let street_address1 = $(form).find('input[name="Street1"]').val(); let street_address2 = $(form).find('input[name="Street2"]').val(); let postcode = $(form).find('input[name="Postcode"]').val(); let suburb = $(form).find('select#shared-dropdown-input-4').val(); let suburbObject = { Text: $('#shared-dropdown-input-4').find(':selected').text(), Id: $('#shared-dropdown-input-4').find(':selected').attr('data-id'), IsNonServiced: $('#shared-dropdown-input-4').find(':selected').attr('data-serviced') } let suburbId = $('#shared-dropdown-input-4').find(':selected').attr('data-id') let dataObject = { Postcode: postcode, Street1: street_address1, Street2: street_address2, Suburb: suburbObject, SuburbId: suburbId } if (!street_address1 || !postcode || !suburb) { if (!street_address1) { $(form).find('input[name="Street1"]').siblings('shared-validation-messages').show() $(form).find('shared-textbox[name="Street1"]').addClass('ng-invalid') } if (!postcode) { $(form).find('input[name="Postcode"]').siblings('shared-validation-messages').show() $(form).find('shared-textbox[name="Postcode"]').addClass('ng-invalid') } if (!suburb) { $(form).find('select#shared-dropdown-input-4').siblings('shared-validation-messages').show() $(form).find('shared-dropdown[name="Suburb"]').addClass('ng-invalid') } else { $('.addressSelectorManual-postcodeSuburbInput').removeClass('empty-drop') } } else { if (isUserLoggedIn) { manualDeliveryAddressCall(dataObject) } else { window.location.href = '/shop/securelogin' } } } $('body').on('click', '#page2.manual button[type="submit"].shopper-action', function(e) { e.preventDefault() manual_delivery() }) $('.fms-form shared-address-selector-manual input').on('keypress', function(e) { if (e.which == 13) { e.preventDefault() manual_delivery() } }) function manualDeliveryAddressCall(data) { $.ajax({ url: `${url}/ui/address/manual`, type: 'POST', contentType: 'application/json;', data: JSON.stringify(data) }).then(res => { let addressId = res.Address.AddressId deliveryAddressUpdateFulfilment(addressId) }) } // pickup and to boot // on-input pick-up address populate with list-items $('body').on('input', '#pickupAddressSelector, #pickupAddressSelectorBoot', function() { const pickup_or_boot = $(this).closest('.page-hide').attr('id') === 'page3' ? 'pickup' : 'boot' var searchVal = $(this).val() if (searchVal.length) { $(this).addClass('input-with-value') } if (!searchVal.length) { $(this).removeClass('input-with-value') } $.ajax({ url: `${url}/ui/StoreLocator/Suburbs`, type: 'GET', data: { "SearchTerm": searchVal } }).then((res) => { $('ul.list.ng-star-inserted').remove() if (pickup_or_boot === 'pickup') $('

    ').insertAfter( '#pickup-results') if (pickup_or_boot === 'boot') $('

      ').insertAfter( '#boot-results') if (!res.Suburbs.length) { $('ul.list.ng-star-inserted').append( `

    • No suburb found. Reset search
    • ` ) } if (res.Suburbs.length > 0) { if (pickup_or_boot === 'pickup') { res.Suburbs.forEach((suburb, index) => { $('ul.list.ng-star-inserted').append(`

    • ${suburb.SuburbStateString}

    • `) }) } if (pickup_or_boot === 'boot') { res.Suburbs.forEach((suburb, index) => { $('ul.list.ng-star-inserted').append(`

    • ${suburb.SuburbStateString}

    • `) }) } } }) }) // reset search when no results found $('body').on('click', '.drawer .reset-search', function(e) { $('#pickupAddressSelector').focus() e.preventDefault() $('#pickupAddressSelector').val('') $('#pickupAddressSelectorBoot').val('') inputIcons($(e.target)) $('ul.list.ng-star-inserted').remove() }) // selecting a suburb from list of suburbs for pickup and boot $('body').on('click', '.suburb-list-item', function() { const pickup_or_boot2 = $(this).closest('.page-hide').attr('id') === 'page3' ? 'pickup' : 'boot' const pickup_or_boot_api_value = $(this).closest('.page-hide').attr('id') === 'page3' ? 'Pickup' : 'DriveUp' const postCode = $(this).data('postcode') if (pickup_or_boot2 === 'pickup') { $('input#pickupAddressSelector').val(postCode) $('.pick-up-warning').addClass('hide') } if (pickup_or_boot2 === 'boot') { $('.direct-boot-warning').addClass('hide') $('input#pickupAddressSelectorBoot').val(postCode) } getListPickupStores({ postCode }) }) // get all stores that match a location and append them to the page function getListPickupStores(location) { return $.ajax({ url: `${url2}/v3/ui/fulfilment/stores`, type: 'GET', data: { ...location } }).then((res) => { //set first address as selected address id if (res && Array.isArray(res) && res.length > 0 && res[0].AddressId) { addressIdItem = res[0].AddressId } $('.stores.ng-star-inserted').remove() $('#page3 fieldset').append( '

      ') const pickUpContent = (pickupOrDriveUp) => { if (pickupOrDriveUp === 'Pickup') { return ` In-store pick up` } if (pickupOrDriveUp === 'DriveUp') { return ` Espresso Martini | Woolworths (2)Direct to boot` } } res.forEach((suburb, index) => { $('.stores.ng-star-inserted').append(`

      ${suburb.Description}

      ${suburb.AddressText}

      ${pickUpContent(suburb.FulfilmentMethod)}

      ${suburb.Distance} km

      `) }) $('.list.ng-star-inserted').html('') }).then(() => { // hide all options after first 4 $('.suburb-list-item2:gt(4)').hide() // select the first option by default $('.suburb-list-item2:first input').prop("checked", true); // append the "view more button" when required let button = `` if ($('.suburb-list-item2').length > 5) { $(document).find('#page3 div.tab-content.ng-star-inserted .stores.ng-star-inserted').append( button) } // hide order options info $('#page3 .tab-content div.cvp.ng-star-inserted').hide() }) } // view more button for suburbs $(document).on('click', '.view-more-button', function() { const pickup_or_boot = $(this).closest('.page-hide').attr('id') === 'page3' ? 'pickup' : 'boot' if (pickup_or_boot === 'pickup') { $('.suburb-list-item2:hidden:lt(5)').show() if ($('.suburb-list-item2:hidden').length == 0) { $('.view-more-button').hide() $('.stores:last-child').css('border', 'none') } } if (pickup_or_boot === 'boot') { $('.suburb-list-item3:hidden:lt(5)').show() if ($('.suburb-list-item3:hidden').length == 0) { $('.view-more-button').hide() } } }) let addressIdItem; let fulfilmentMethod; // select a pickup or driveup location from the menu $('body').on('click', '.suburb-list-item2', function() { addressIdItem = $(this).data('id') fulfilmentMethod = $(this).data('fulfilmentMethod') // update input icons $('.suburb-list-item2 input').prop("checked", false); $(this).find('input').prop("checked", true); }) // pickup save button $('body').on('click', '.pickup-save', function(e) { e.preventDefault(e) if ($('#pickupAddressSelector').val() != '' || $('.suburb-list-item2').length) { $('.pick-up-warning').addClass('hide') $(this).find('.spinner-button').removeClass('hide') $(this).find('.button-text').addClass('hide') pickupMethodFulfilmentCall(fulfilmentMethod) let _this = $(this) setTimeout(function() { $(_this).find('.spinner-button').addClass('hide') $(_this).find('.button-text').removeClass('hide') }, 5000) } else { $('.pick-up-warning').removeClass('hide') } }) function pickupMethodFulfilmentCall(pickupMethod) { if (addressIdItem) { if (isUserLoggedIn) { $.ajax({ url: `${url}/ui/Fulfilment`, type: 'POST', data: { addressId: addressIdItem, fulfilmentMethod: pickupMethod } }).then(() => { getCustomerInfoAsync().then((res) => { totalData = res updateDeliveryTimeDisplay() updateDeliveryMethod() // open time select modal openDeliveryPickupSidePanel() }) }).then(() => { }) } else { window.location.href = '/shop/securelogin' } } } // update delivery / pickup method display function updateDeliveryMethod() { if (totalData.GetDeliveryInfoRequest && totalData.GetDeliveryInfoRequest.DeliveryMethod) { $('.linkButton.fulfilment-button.ng-star-inserted.back-button').hide() } if (totalData.GetDeliveryInfoRequest && (totalData.GetDeliveryInfoRequest.DeliveryMethod == 'Courier' || totalData.GetDeliveryInfoRequest.DeliveryMethod == 'Null')) { } if (isUserLoggedIn) { if (totalData && totalData.GetDeliveryInfoRequest && totalData.GetDeliveryInfoRequest.DeliveryMethod) { let deliveryDisplayText = totalData.GetDeliveryInfoRequest?.Address?.Description ? totalData .GetDeliveryInfoRequest?.Address?.Description : totalData.GetDeliveryInfoRequest?.Address ?.AddressText ? totalData.GetDeliveryInfoRequest?.Address?.AddressText : "" $('#page1').remove() if (totalData.GetDeliveryInfoRequest.DeliveryMethod == 'Pickup') { $('.lux-fulfilment-method').html(` Espresso Martini | Woolworths (3) Pick up `); $('#deliveryContent, #delivery_display_mobile').html(`

      Pick up: ${ deliveryDisplayText} Pick up ${deliveryDisplayText}

      `) $('.fulfilment-delivery-address').html(deliveryDisplayText); } else if (totalData.GetDeliveryInfoRequest.DeliveryMethod == 'DriveUp') { $('.lux-fulfilment-method').html(` Espresso Martini | Woolworths (4) Direct to boot `); $('#deliveryContent, #delivery_display_mobile').html(`

      Espresso Martini | Woolworths (5)

      Direct to boot: ${deliveryDisplayText} Pick up Direct to boot ${deliveryDisplayText}

      `) $('.fulfilment-delivery-address').html(deliveryDisplayText); } else { $('.lux-fulfilment-method').html(` Deliver to `); $('#deliveryContent, #delivery_display_mobile').html(`

      Delivery to: ${deliveryDisplayText} Delivery to ${deliveryDisplayText}

      `) } $('.fulfilment-delivery-address').html(deliveryDisplayText); $(".wx-fs-header__fulfilment-section-arrow .open-side.deliver-to").html('Change'); } } } // update delivery / pickup chosen time display function updateDeliveryTimeDisplay() { let delivery_pickup_text = 'When suits? ' const data = totalData.GetDeliveryInfoRequest let dateString; if (data.ReservedDate.Date) { let reservedDate = moment(data.ReservedDate.Date); let today = moment(); let tomorrow = moment().add(1, 'days'); let time_format_day; if (reservedDate.isSame(today, 'day')) { time_format_day = "Today"; } else if (reservedDate.isSame(tomorrow, 'day')) { time_format_day = "Tomorrow"; } else { time_format_day = reservedDate.format('ddd'); } delivery_pickup_text = 'Chosen time: ' dateString = `

      ` } else { dateString = `

      `; } $('#select_a_time, #select_a_time_mobile').html('') $('#select_a_time, #select_a_time_mobile').append(dateString) if (data.ReservedDate.Date) { $(".wx-fs-header__fulfilment-section-arrow .open-side.time-to").html('Change'); } } // general // prevent forms submitting on enter $('.fms-form').submit(function(e) { e.preventDefault() }) // function to only allow number input function validate(evt) { var theEvent = evt || window.event; // Handle paste if (theEvent.type === 'paste') { key = event.clipboardData.getData('text/plain'); } else { // Handle key press var key = theEvent.keyCode || theEvent.which; key = String.fromCharCode(key); } var regex = /[0-9]|\./; if (!regex.test(key)) { theEvent.returnValue = false; if (theEvent.preventDefault) theEvent.preventDefault(); } } // close search options dropdown when cicking away from it $('body').on('blur', '#deliveryAddressSelector, #pickupAddressSelector, #pickupAddressSelectorBoot', function() { setTimeout( function() { $('ul.list.ng-star-inserted').hide() }, 500) }); // reopen search options when focus back $('body').on('focus', '#deliveryAddressSelector, #pickupAddressSelector, #pickupAddressSelectorBoot', function() { $('ul.list.ng-star-inserted').show() }); // search input $('#pickupAddressSelectorBoot, #pickupAddressSelector, #deliveryAddressSelector').on('input', function(e) { inputIcons($(this)) }) $('#pickupAddressSelectorBoot, #pickupAddressSelector, #deliveryAddressSelector').on('focus', function(e) { inputIcons($(this)) }) $('#pickupAddressSelectorBoot, #pickupAddressSelector, #deliveryAddressSelector').on('blur', function(e) { inputIcons($(this)) }) // switch between geolocation icon and the clear text icon function inputIcons(_this) { let _thisParent = _this.closest('shared-pickup-address-selector') let searchTerm = $(_thisParent).find('input').val() if (typeof searchTerm != 'undefined' && searchTerm.length > 0) { if (!$(_thisParent).find('.clear-text').is(':visible')) { $(_thisParent).find('shared-textbox').append( `

      ` ) } $('.geolocate-icon').hide() } if (typeof searchTerm != 'undefined' && !searchTerm.length) { $(_thisParent).find('.clear-text').remove() $('.geolocate-icon').show() } } $('body').on('click', 'shared-pickup-address-selector .clear-text', function() { $(this).siblings('input').val('') inputIcons($(this).siblings('input')) }) // geolocation let pickupType; // get user location if possible function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(getMatchingLocations); // getMatchingLocations() } else { alert("Geolocation is not supported by this browser."); } } function getMatchingLocations(position) { getListPickupStores(pickupType, { latitude: position.coords.latitude, longitude: position.coords.longitude }) } let pickup_text = 'Search for Pick up location'; let direct_boot_text = 'Search for a Direct to boot location'; let user_location_text = 'Using your location'; $(document).on('keypress ', 'input[name="pickupAddressSelector"]', function() { if ($('#pickupAddressSelector', this)) { $(this).siblings('label.ng-star-inserted').text(pickup_text) } else if ('#pickupAddressSelectorBoot') { $(this).siblings('label.ng-star-inserted').text(direct_boot_text) } }) $(document).on('click', function(e) { if (!$(e.target).is('#geolocationiconDriveUp') && !$(e.target).is('#geolocationiconPickup')) return pickupType = $(e.target).is('#geolocationiconDriveUp') ? 'DriveUp' : 'Pickup' if (pickupType == 'DriveUp') { $('#geolocationiconDriveUp').siblings('shared-typeahead').find('label.ng-star-inserted').text( user_location_text) } else { $('#geolocationiconPickup').siblings('shared-typeahead').find('label.ng-star-inserted').text( user_location_text) } e.preventDefault(e) getLocation() }) $(document).on("click", ".add-address-button", function(e) { e.preventDefault(); $('.previous-delivery, .add-address-button').hide() $('.find-delivery, .previous-add').show() $('#manual-delivery-search').hide() $('#manual-delivery-buttons-container').hide() $('#page2').removeClass('manual') }); $(document).on("click", ".previous-add", function(e) { e.preventDefault(); $('.previous-delivery, .add-address-button').show() $('.find-delivery, .previous-add').hide() $('#manual-delivery-search').hide() $('#manual-delivery-buttons-container').hide() $('#page2').removeClass('manual') });

      ` ) $(this).find('.product-tile-v2--image img').addClass('is-unavailable'); } else { $(this).find('.cartControls-addButton').show() $(this).find(`.cartControls-inTrolleyWrapper`).remove() $(this).find(`.cart-item-unavailable`).remove() } }); } // update cart with additional populate cart data function updateCart() { const data = cartData $('.item-count-amount').html(data.TotalTrolleyItemQuantity) // add items to cart const items = data.AvailableItems const unavailableItems = data.UnavailableItems populateRHSCart(items, unavailableItems) // update total const total = data.Totals.SubTotal; const totalSavings = data.Totals.TotalSavings.toFixed(2); const numberItems = data.TotalTrolleyItemQuantity; const everydayMarketTotal = data.Totals.MarketTotal; const woolworthstTotal = data.Totals.WoolworthsTotal; updateCartTotal(total, totalSavings, numberItems, everydayMarketTotal, woolworthstTotal) } // populate the RHS cart with the product items // show differently if items are unavailable or available function populateRHSCart(availableItems, unavailableItems) { $('wow-cart-products .auto_products-in-cart').html('') $('#unavailable-items-container').remove() if (unavailableItems.length > 0) { $('wow-cart-products').prepend( `

      These items are currently unavailable

      ` ) } unavailableItems.forEach((item) => { $('wow-cart-products #unavailable-items-container .cart-items-container').append( `

      Unavailable

      ${item.Name} ${item.PackageSize}

      ` ) }) availableItems.forEach((item) => { let price = item.SalePrice.toFixed(2) let priceSml = price.split('.')[1] let priceLrg = price.split('.')[0] $('wow-cart-products .auto_products-in-cart').append(`

      ${item.Discount ? '

      SAVE $' + item.Discount.toFixed(2) + '

      ' : ''}

      ${item.Name} ${item.PackageSize}

      ${ item.QuantityInTrolley >= item.ProductLimit ? ` ${item.ProductLimit} item limit ` : item.QuantityInTrolley >= item.SupplyLimit ? ` ${item.SupplyLimit} item(s) left ` : '' }

      $${priceLrg}

      .${priceSml}

      ${item.SalePrice.toFixed(2) != (item.ListPrice * item.Quantity).toFixed(2) ? ' Was $' + (item.ListPrice * item.Quantity).toFixed(2) + ' ' : ''}

      `) }) if ((availableItems.length + unavailableItems.length) == 0) { let insert_empty = `Espresso Martini | Woolworths (8)

      Your cart is empty

      Continue shopping to browse and search for items.

      ` $('.checkout-buttons').addClass('is-disabled') $('.scroll-wrapper .cart-content').hide() $('.scroll-wrapper .empty-cart-container').show() $('.scroll-wrapper .empty-cart-container').html(insert_empty) } else { $('.checkout-buttons').removeClass('is-disabled') $('.scroll-wrapper .cart-content').show() $('.scroll-wrapper .empty-cart-container').html('') $('.scroll-wrapper .empty-cart-container').hide() } } // click continue shopping button in cart $('body').on('click', '.empty-cart-container button', function() { if (shopping_pages || campaign_page) { tracking_click_continue_shopping_button() } }) // update the cart total in header and at bottom of rhs cart function updateCartTotal(total, TotalSavings, numberItems, everydayMarketTotal, woolworthstTotal) { if (total.toFixed(2) == 0.00) { $('.order-total-number.current').text(`$0.00`); $('.wx-header-checkout-amount-sr').text(`$0.00`); $('.wx-header-checkout-plural-sr').text('item'); $('.cart-checkout-total__currency').text(`$0`); $('.headerCheckout-cartButtonTotal').text(`$0.00`); $('.lux-everyday-market-price').text(`$0`); $('.lux-woolworths-price').text(`$0`); updateCartAmountIcon(numberItems); } else { $('.order-total-number.current').text(`$${total.toFixed(2)}`); $('.wx-header-checkout-amount-sr').text(`$${total.toFixed(2)}`); $('.cart-checkout-total__currency').text(`$${total.toFixed(2)}`); $('.headerCheckout-cartButtonTotal').text(`$${total.toFixed(2)}`); $('.lux-everyday-market-price').text(`$${everydayMarketTotal > 0 ? everydayMarketTotal.toFixed(2) : 0}`); $('.lux-woolworths-price').text(`$${woolworthstTotal > 0 ? woolworthstTotal.toFixed(2) : 0}`); if (numberItems > 1) { $('.wx-header-checkout-plural-sr').text('items'); } else { $('.wx-header-checkout-plural-sr').text('item'); } updateCartAmountIcon(numberItems); } $('.cart-totalSavings').remove() if (!!+TotalSavings) { $('.saving-count-container .total-savings').remove() const savingsHTML = ` Total saved: $${TotalSavings}` $('.saving-count-container').prepend(savingsHTML) } function updateCartAmountIcon(numberItems) { if (numberItems > 0) { // desktop $('.wx-fs-header__checkout-quantityPill .quantity-pill-number.current').text(numberItems); $('.wx-header-checkout-quantity-sr').text(numberItems); // mobile $('.headerCheckout-cartButtonIcon').html(`

      ${numberItems}

      `); $('.wx-fs-header__checkout-quantityPill').removeClass('wx-fs-header__checkout-quantityPillHidden'); } else { $('.wx-fs-header__checkout-quantityPill').addClass('wx-fs-header__checkout-quantityPillHidden'); } } } // if the user has WOW no rewards function insertNoReward() { $('.cartLoyalty-container').html('') const noRewardHTML = `

      Earn points on this shop Espresso Martini | Woolworths (9)

      Collect points on this shop

      Link Everyday Rewards Card

      ` $('.cartLoyalty-container').html(noRewardHTML) } // if the user has WOW rewards function insertReward(rewardData, cartTotal) { $('.cartLoyalty-container').html('') if (rewardData) { const currentBalance = cartTotal let rewardHTML if (rewardData.WowRewardsToSpend > 0) { rewardHTML = `

      Espresso Martini | Woolworths (10)

      Everyday Rewards, off next shop

      Espresso Martini | Woolworths (11) $${rewardData.WowRewardsToSpend}

      off next shop

      Everyday Rewards, You'll Earn

      Espresso Martini | Woolworths (12) ${currentBalance} pts

      You'll collect

      ` } else { rewardHTML = `

      Everyday Rewards, You'll Earn Espresso Martini | Woolworths (13)

      Espresso Martini | Woolworths (14) ${currentBalance} pts

      You'll collect

      ` } $('.cartLoyalty-container').html(rewardHTML) } } // check if rewards are applicable to user data function checkRewardStatus() { if (isUserLoggedIn) { const rewardData = cartData.WowRewardsSummary const cartTotal = Math.ceil(cartData.Totals.SubTotal) // if user doesnt have rewards card if (rewardData && !rewardData.IsWowRewardsCardRegistered) { insertNoReward() } // if user does have rewards card if (rewardData && rewardData.IsWowRewardsCardRegistered) { insertReward(rewardData, cartTotal) } } } // save to cart list function savedButton() { const savedButtonHTML = '

      Saved

      ' $('button.cartSaveList-saveButton').show() $('button.cartSaveList-saveButton span').hide() $('.cartSaveList-saveButton', document).prop('disabled', true) $('button.cartSaveList-saveButton').append(savedButtonHTML) setTimeout(function revertToSaveButton() { $('button.cartSaveList-saveButton').children('.cartSaveList-SavedContainer').remove( '.cartSaveList-SavedContainer') $('button.cartSaveList-saveButton span').show() }, 2000) } // populate save cart const populateSaveCartButton = function() { $('#save-remove-container').remove() const data = cartData.AvailableItems if (data.length) { const html = `
      ` $('.cart-content').append(html) } else { $('#save-remove-container').remove() } } // ********************************** events ****************************** // update item ajax call var updateItemTimeout; const updateItemAPICall = function(stockcode, newQuantity, checkMainProd, checkSimilarProd) { $.ajax({ url: `${url}/ui/Trolley/UpdateItem`, type: "POST", data: { stockcode, quantity: newQuantity } }).then((res) => { cartData = res updateCart() if (checkMainProd) checkIfMainProdInCart() if (checkSimilarProd) checkIfSimilarProdInCart() checkRewardStatus() // shopping only tracking if (shopping_pages || campaign_page) { if (newQuantity > 0) tracking_update_item_in_cart(stockcode, newQuantity) if (newQuantity == 0) tracking_remove_item_from_cart(stockcode, newQuantity) } }) } // add item to cart on button click $('body').on('click', '.cartControls-addButton', function() { const id = $(this).data('sku') addToCartAPICall(id) }) // remove item from cart $('body').on('click', '.cart-item .iconAct-Close_Cancel', function() { const stockCode = $(this).closest('.cart-item').data('stockcode') $.ajax({ url: `${url}/ui/Trolley/Remove`, type: 'POST', data: { Stockcode: stockCode } }).then(res => { if (shopping_pages || campaign_page) { tracking_remove_item_from_cart(stockCode, 0) } cartData = res updateCartProductsRewards() }) }) const CART_QUANTITY_DEBOUNCE_TIME = 200; // update item quantity in cart const supplyLimitMessage = (limit, quantityOrSupply) => { const message = quantityOrSupply === 'quantity' ? `${limit} item(s) left` : `${limit} item limit`; return `

      ${message}

      `; }; const handleQuantityChange = ($input, supplyLimit, productLimit, stockCode, containerClass) => { let value = parseFloat($input.val()); const limitType = supplyLimit < productLimit ? 'quantity' : 'limit'; const $container = $input.closest(containerClass); if (value > Math.min(supplyLimit, productLimit)) { value = Math.min(supplyLimit, productLimit); $input.val(value); $input.siblings('.cartControls-incrementButton').attr('disabled', 'disabled'); $container.find('.message-wrapper').prepend(supplyLimitMessage(value, limitType)); } else { $input.siblings('.cartControls-incrementButton').removeAttr('disabled'); $container.find('.max-supply-limit-message').remove(); } debounceUpdate(stockCode, value); }; const handleProductQuantityClick = function(containerClass) { const $container = $(this).closest(containerClass); const supplyLimit = $container.data('supply-limit'); const productLimit = $container.data('product-limit'); const stockCode = $container.data('stockcode') || $container.data('sku'); const $input = $(this).siblings('input'); const step = parseFloat($input.attr('step')); const value = parseFloat($input.val()); const isIncrement = $(this).closest('.cartControls-incrementButton').length > 0; const isDecrement = $(this).closest('.cartControls-decrementButton').length > 0; const newValue = isIncrement ? value + step : value - step; if (isIncrement && (newValue <= supplyLimit && newValue <= productLimit)) { $input.val(newValue); } else if (isDecrement && newValue >= 0) { $input.val(newValue); } handleQuantityChange($input, supplyLimit, productLimit, stockCode, containerClass); }; const handleTextInput = function(containerClass) { const $container = $(this).closest(containerClass); const supplyLimit = $container.data('supply-limit'); const productLimit = $container.data('product-limit'); const stockCode = $container.data('stockcode') || $container.data('sku'); handleQuantityChange($(this), supplyLimit, productLimit, stockCode, containerClass); }; // handle cart item quantity click change $('body').on('click', '.cart-item .cartControls-quantityButton', function() { handleProductQuantityClick.call(this, '.cart-item'); }); // handle cart item quantity number input $('body').on('input', '.cart-item .cartControls-quantityInput', function() { handleTextInput.call(this, '.cart-item'); }); // handle product quantity click change $('body').on('click', '.product .cartControls-quantityButton', function() { handleProductQuantityClick.call(this, '.product'); }); // handle product quantity number input $('body').on('input', '.product .cartControls-quantityInput', function() { handleTextInput.call(this, '.product'); }); const debounceUpdate = (stockCode, value) => { clearTimeout(updateItemTimeout); updateItemTimeout = setTimeout(updateItemAPICall, CART_QUANTITY_DEBOUNCE_TIME, stockCode, value, true, true); }; // finish update item quantity in cart $('body').on('click', '#order-review-button', function() { const unavailableItems = cartData.UnavailableItems if (unavailableItems.length) { const unavailableStockCodes = unavailableItems.map(item => item.Stockcode) $.ajax({ url: `${url}/ui/Trolley/RemoveItems`, type: 'POST', contentType: 'application/json;', data: JSON.stringify({ Stockcodes: [...unavailableStockCodes] }) }).then(res => { cartData = res updateCartProductsRewards() }) } }) // save cart as list button $('body').on('click', '.cartSaveList-button', function() { $(this).hide() $('.product-actionsClearCart').hide() const listInputHTML = `

      Save cart as a list

      ` $(listInputHTML).insertAfter($(this)) if (shopping_pages || campaign_page) { tracking_click_save_to_list_checkout_panel() } }) $('body').on('input', '#shared-text-input-8', function() { $('shared-validation-messages').hide() // if no value if ($(this).val() != '') { $('#cartSaveList-input .clear-text').addClass('typing-change') $(this).addClass('input-with-value') $('.cartSaveList-saveButton', document).prop('disabled', false) } else { $('#cartSaveList-input .clear-text').removeClass('typing-change') $(this).removeClass('input-with-value') $('.cartSaveList-saveButton', document).prop('disabled', true) } }) $('body').on('click', '.cartSaveList-input .clear-text', function() { $('.cartSaveList-editing').remove() $('.cartSaveList-button._saveCartListInitial').click() }) // save cart as list input $('body').on('click', '.cartSaveList-saveButton', function(e) { e.preventDefault() $('.loading-button').show() $('button.cartSaveList-saveButton').hide() if (shopping_pages || campaign_page) { tracking_click_save_after_user_enter_list_name_cart() } if (isUserLoggedIn) { const Name = $('#shared-text-input-8').val() $.ajax({ url: `${url}/ui/Trolley/SaveAsList`, type: 'POST', contentType: 'application/json;', data: JSON.stringify({ Name }) }).then((res) => { if (!res.Success) { $('shared-validation-messages').hide() let msg = res.Message $('shared-validation-messages .validationMessages-text').text(`${msg}`) $('shared-validation-messages').show() $('.loading-button').hide() $('button.cartSaveList-saveButton').show() $('.cartSaveList-saveButton', document).prop('disabled', false) } if (res.Success) { $('.loading-button').hide() savedButton() updateListItems() } }) } else { window.location.href = 'https://www.woolworths.com.au/shop/securelogin' } }) // close button --- after succesful list add $('body').on('click', '.cartSaveList-closeSavedButton', function() { $('shared-cart-save-list').html( `` ) }) // cancel cart button $('body').on('click', '.cartSaveList-cancelButton', function(e) { e.preventDefault() $('.cartSaveList-button').show() $('.cartSaveList-editing').remove() $('.product-actionsClearCart').show() }) // remove all prods button $('body').on('click', '.linkButton.product-actionsClearCart', function() { const html = `

      Are you sure you would like to remove all products from the cart?

      ` $('.remove-all-items-container').append(html) $('.remove-all-items-container').show() $('.cart-contents').hide() // tracking if (shopping_pages || campaign_page) { tracking_click_remove_all_button() } }) // remove all prods cancel $('body').on('click', '.clear-cart-container .linkButton', function() { $('.remove-all-items-container').html('') $('.remove-all-items-container').hide() $('.cart-contents').show() }) // remove all prods yes $('body').on('click', '.clear-cart-container .primary.m', function() { clearProductsFromCartAPICall() if (shopping_pages || campaign_page) { tracking_click_remove_all_confirmation_button() } setTimeout(function() { $('.remove-all-items-container').hide() $('.cart-contents').show() }, 500); }) // order summary toggle $('.cart-checkout-summary__heading').click(function() { $('.cart-checkout-summary__content').toggleClass('is-open') $(this).find('i').toggleClass('iconAct-Chevron_Up iconAct-Chevron_Down') }) // click on checkout button if (shopping_pages || campaign_page) { $('.checkout-bottom').click(function() { tracking_click_checkout_bottom_button() }) }

      Espresso Martini | Woolworths (2024)

      FAQs

      What liquor is best for an espresso martini? ›

      The liquor base for an espresso martini co*cktail is vodka. We recommend choosing a premium unflavored vodka made with the finest ingredients to help the drink truly shine. The drink also incorporates a coffee liqueur.

      What is a dirty espresso martini? ›

      Jump to Recipe - Print Recipe. Celebrate the holiday season with the coziest and most delicious Dirty Chai Espresso Martini. Homemade chai tea simple syrup mixed with your favorite vodka, Kahlúa and a strong shot of espresso. This is the perfect co*cktail to end the night!

      Is Kahlúa or Baileys better for espresso martini? ›

      Espresso Martini Recipe Ingredients

      I recommend Kahlua for a strong coffee tasting espresso martini, or Baileys for a creamier espresso martini.

      How do bartenders make espresso martini? ›

      Directions
      1. Combine vodka, Mr. Black, and espresso in a co*cktail shaker filled with ice. Cover and shake vigorously for 30 seconds.
      2. Pour mixture into a chilled coupe glass, and garnish with espresso beans.
      Oct 3, 2023

      What's the point of an espresso martini? ›

      Created with only three, sometimes four, magical ingredients – espresso, Kahlua, vodka and maybe a little simple syrup – the potion serves as a delicious pick-me-up for diehards needing a caffeine jolt to keep the late-night party going. Or, some say, it's a liquor-infused elixir to liven up any breakfast event.

      What is a substitute for Kahlua in an espresso martini? ›

      For example, as much as the Kahlua is an integral part — it brings in some extra coffee flavor, as well as some key sweetness — it doesn't hurt to swap it out for something a little more chocolatey: Bailey's.

      Is Kahlua or Mr. Black better? ›

      Mr Black has a more adult taste with less sugar than Kahlua and more coffee flavour but is also ridiculously easy to make.

      What makes an espresso martini thick? ›

      How do I make my espresso martini creamier? The froth that develops when you shake the co*cktail gives you that creaminess. Make sure you're shaking up a good froth for 15-20 seconds.

      Why do people order espresso martinis? ›

      The espresso martini is popular because it's simply a delicious drink: Beautiful to look at (as most martinis are), sweet and smooth, and a sinful mix of caffeine and alcohol. It's suitable for almost any occasion be it brunch, aperitif, after dinner, or just because.

      What do 4 beans in an espresso martini mean? ›

      This is the co*cktail's trademark and are said to represent health, wealth and happiness and come from the traditional serving of Sambuca in Italy, where the beans are called con la mosca, which means “with the fly”. You can chew and eat the coffee beans in both co*cktails but it is a personal choice!

      What is the white stuff on espresso martini? ›

      The fresh shot of espresso is a really important element of the 'perfect' espresso martini, not just for its beautiful freshly brewed coffee taste, but for it's foamy creama, which helps build the foam layer found on the top of an espresso martini, which is usually garnished with 3 whole coffee beans.

      What vodka is best for espresso martini? ›

      McGurk recommends a wheat vodka for its 'sweeter flavour profile and oily texture'. In our taste test, West Dorset's Black Cow, distilled from whey, gives a uniquely creamy, chocolatey hit – perfect for an Espresso Martini.

      How to get a frothy espresso martini? ›

      Instructions
      1. Combine the espresso, vodka, rum, simple syrup and vanilla extract in a shaker filled with ice cubes.
      2. Shake vigorously for at least 15 seconds until it's cold and frothy.
      3. Pour into a chilled martini glass, add three drops of orange bitters and your desired garnish.

      Should coffee be hot or cold for espresso martini? ›

      The recipe in Difford's Guide's 365 Days of co*cktails specifies the espresso must be “freshly made and hot” while Nigella Lawson cautions readers of her Christmas book that it should be prepared the night before “so it's properly cold, chilled if possible, before you start”.

      Does espresso martini actually have caffeine? ›

      How much caffeine is in an espresso martini? Typically about 60 mg (most espresso martinis contain one shot, or one ounce, of coffee), but some co*cktails have cold brew, cold brew concentrate (which is stronger than cold brew) or plain coffee, which has about half of the caffeine found in espresso.

      What is espresso drink made of? ›

      Espresso is a rich, concentrated coffee drink. A shot of espresso is different from an “ordinary” cup of coffee mainly in the way it's prepared. The beans are ground very fine and packed tight, then pressurized water is pulled through them to create a small serving of full-bodied, flavorful coffee.

      What are the standards in an espresso martini? ›

      For the co*cktail
      • ice.
      • 100ml vodka.
      • 50ml freshly brewed espresso coffee.
      • 50ml coffee liqueur.
      • 4 coffee beans (optional)

      What can you put in an espresso martini instead of vodka? ›

      Garnish with coffee beans – if you're feeling fancy. No vodka? No problem! You can make an Espresso Martini without vodka – you could make an Espresso Martini with rum, an Espresso Martini with gin or an Espresso Martini with tequila.

      Top Articles
      Latest Posts
      Article information

      Author: Velia Krajcik

      Last Updated:

      Views: 6372

      Rating: 4.3 / 5 (54 voted)

      Reviews: 85% of readers found this page helpful

      Author information

      Name: Velia Krajcik

      Birthday: 1996-07-27

      Address: 520 Balistreri Mount, South Armand, OR 60528

      Phone: +466880739437

      Job: Future Retail Associate

      Hobby: Polo, Scouting, Worldbuilding, Cosplaying, Photography, Rowing, Nordic skating

      Introduction: My name is Velia Krajcik, I am a handsome, clean, lucky, gleaming, magnificent, proud, glorious person who loves writing and wants to share my knowledge and understanding with you.