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

Industries We Support

At Greencut Group, our services extend to a number of different industries. We provide a wide range of options that everyone can benefit from. Take a deeper look into the kinds of industries our professional team has experience working in and get in touch to take advantage of our network and skills.

Specialized equipment for commercial construction_edited.jpg

Commercial

Contracting Done Right

qo6tkt9k10kkiylf_edited.jpg

Municipal

Customized Professional Services

Image by todd kent

Residential

What You Need

Industries: Industries

©2022 by Greencut Group. Proudly created with Wix.com

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)}`; }