let map; let marker; function initMap() { map = new google.maps.Map(document.getElementById("map"), { center: { lat: 53.5461, lng: -113.4938 }, // Default center, e.g., Edmonton zoom: 10, }); map.addListener("click", (event) => { placeMarker(event.latLng); }); } function placeMarker(location) { if (marker) { marker.setPosition(location); } else { marker = new google.maps.Marker({ position: location, map: map, }); } // Pass the location to calculate delivery rate calculateDeliveryRate(location); } $w("#timeSlotDropdown").options = [ { label: "9:00 AM - 11:00 AM", value: "9-11" }, { label: "11:00 AM - 1:00 PM", value: "11-1" }, { label: "1:00 PM - 3:00 PM", value: "1-3" }, ]; function proceedToCheckout() { const deliveryDetails = { address: marker.getPosition().toString(), rate: $w("#deliveryRate").text, timeSlot: $w("#timeSlotDropdown").value, }; // Add custom order details to the checkout flow wixStores.addProductToCart("productID", { options: { DeliveryDetails: JSON.stringify(deliveryDetails) }, }).then(() => { wixLocation.to("/checkout"); }); }
top of page

Projects Portfolio

At Greencut Group, we help individuals and businesses with our top of the line services. Since starting out, we’ve taken on a variety of projects, always providing personalized attention to ensure precision and satisfaction with all of our work. Take a look at our recent projects and get in touch today to start your own.

Office Building

Municipal Building

January 25, 2025

Buildings Close Together

Apartment Complex

January 25, 2025

Large Modern House with Pool

Contemporary Home

January 25, 2025

Projects: Projects
bottom of page
async function calculateDeliveryRate(destination) { const origin = "123 Aggregate Rd, Edmonton, AB"; // Your loading center const apiKey = "YOUR_API_KEY"; const url = `https://maps.googleapis.com/maps/api/directions/json?origin=${origin}&destination=${destination.lat()},${destination.lng()}&key=${apiKey}`; const response = await fetch(url); const data = await response.json(); if (data.routes && data.routes.length > 0) { const distance = data.routes[0].legs[0].distance.value / 1000; // Distance in km const deliveryRate = calculateRate(distance); displayDeliveryRate(deliveryRate); } } function calculateRate(distance) { const baseRate = 50; // Base delivery fee const perKmRate = 2; // Per km charge return baseRate + distance * perKmRate; } function displayDeliveryRate(rate) { $w("#deliveryRate").text = `$${rate.toFixed(2)}`; }