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"); }); } AIzaSyApN6uBDFDVUoGASdj31D0ED1GGB7aJ7EM
top of page

clean top soil, priced per tandem load 

Top Soil

C$370.00Price
    Product Page: Stores_Product_Widget
    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)}`; }