{"id":16,"date":"2026-08-13T13:43:09","date_gmt":"2026-08-13T13:43:09","guid":{"rendered":"https:\/\/rm.dev.rwills.net\/?page_id=16"},"modified":"2026-08-13T13:43:09","modified_gmt":"2026-08-13T13:43:09","slug":"delivery","status":"publish","type":"page","link":"https:\/\/rosewoodmeadow.com\/index.php\/delivery\/","title":{"rendered":"Delivery"},"content":{"rendered":"\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-e35d3e13 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<div class=\"wp-block-group is-layout-grid wp-container-core-group-is-layout-996ff260 wp-block-group-is-layout-grid\">\n<h4 class=\"wp-block-heading wp-container-content-1b8dee80\">Local Delivery (Somerset Area)<\/h4>\n\n\n\n<h4 class=\"wp-block-heading wp-container-content-5e2576f9\">Postal Egg Delivery<\/h4>\n\n\n\n<div id=\"delivery-app\" style=\"padding: 2rem; border: 1px solid var(--wp--preset--color--foreground, #333); border-radius: 12px; margin: 40px auto; background-color: transparent; color: var(--wp--preset--color--foreground, #000); box-shadow: 0 4px 15px rgba(0,0,0,0.05);\">\n    \n    <div style=\"margin-bottom: 20px;\">\n        <label style=\"display: block; margin-bottom: 8px; font-weight: 600;\">Enter Your Postcode<\/label>\n        <input type=\"text\" id=\"userPostcode\" placeholder=\"e.g. BA20 1AA\" style=\"width: 100%; padding: 14px; border: 1px solid var(--wp--preset--color--foreground); border-radius: 6px; background: transparent; color: inherit; text-transform: uppercase; box-sizing: border-box;\">\n    <\/div>\n\n    <button onclick=\"calculateDelivery()\" style=\"width: 100%; padding: 16px; background-color: var(--wp--preset--color--primary); color: var(--wp--preset--color--background); border: none; border-radius: 6px; font-weight: bold; font-size: 1em; cursor: pointer; transition: opacity 0.2s;\">\n        Calculate Cost\n    <\/button>\n\n    <div id=\"loader\" style=\"display:none; margin-top: 20px; text-align: center; font-style: italic;\">Mapping your route&#8230;<\/div>\n    <div id=\"result\" style=\"margin-top: 25px; padding: 20px; border: 2px solid var(--wp--preset--color--primary); border-radius: 8px; display: none; background-color: rgba(var(--wp--preset--color--primary-rgb), 0.05);\"><\/div>\n<\/div>\n\n<script>\nasync function calculateDelivery() {\n    const input = document.getElementById('userPostcode').value.trim();\n    const resultDiv = document.getElementById('result');\n    const loader = document.getElementById('loader');\n    \n    \/\/ STARTING POSTCODE\n    const basePostcode = \"TA14 6RH\";\n\n    if (!input) {\n        alert(\"Please enter a valid UK postcode\");\n        return;\n    }\n\n    loader.style.display = \"block\";\n    resultDiv.style.display = \"none\";\n\n    try {\n        \/\/ 1. Get Lat\/Lon for BOTH postcodes via postcodes.io\n        const [resStart, resEnd] = await Promise.all([\n            fetch(`https:\/\/api.postcodes.io\/postcodes\/${basePostcode}`).then(r => r.json()),\n            fetch(`https:\/\/api.postcodes.io\/postcodes\/${input}`).then(r => r.json())\n        ]);\n\n        if (resStart.status !== 200 || resEnd.status !== 200) {\n            throw new Error(\"Postcode not recognized. Please check the spelling.\");\n        }\n\n        const start = resStart.result;\n        const end = resEnd.result;\n\n        \/\/ 2. Get DRIVING distance via OSRM (Road route)\n        const routeRes = await fetch(`https:\/\/router.project-osrm.org\/route\/v1\/driving\/${start.longitude},${start.latitude};${end.longitude},${end.latitude}?overview=false`);\n        const routeData = await routeRes.json();\n\n        if (routeData.code !== 'Ok') {\n            throw new Error(\"No road route found between these locations.\");\n        }\n\n        \/\/ Convert meters to miles\n        const distanceMiles = routeData.routes[0].distance * 0.000621371;\n\n        \/\/ 3. Logic: \u00a31 per mile, Min \u00a33, Round up to next pound\n        let cost = Math.ceil(distanceMiles);\n        if (cost < 3) cost = 3;\n\n        loader.style.display = \"none\";\n        resultDiv.style.display = \"block\";\n        resultDiv.innerHTML = `\n            <div style=\"display: flex; justify-content: space-between; margin-bottom: 8px; opacity: 0.8;\">\n                <span>Estimated Distance:<\/span>\n                <span>${distanceMiles.toFixed(1)} miles<\/span>\n            <\/div>\n            <div style=\"display: flex; justify-content: space-between; font-size: 1.3em; font-weight: 800; border-top: 1px solid var(--wp--preset--color--foreground); padding-top: 10px;\">\n                <span>Total Delivery:<\/span>\n                <span>\u00a3${cost}.00<\/span>\n            <\/div>\n        `;\n\n    } catch (err) {\n        loader.style.display = \"none\";\n        resultDiv.style.display = \"block\";\n        resultDiv.style.borderColor = \"red\";\n        resultDiv.innerHTML = `<span style=\"color: red; font-weight: bold;\">${err.message}<\/span>`;\n    }\n}\n<\/script>\n\n\n\n<div id=\"egg-calculator\" style=\"padding: 2rem; border: 1px solid var(--wp--preset--color--foreground, #333); border-radius: 12px; margin: 40px auto; background-color: transparent; color: var(--wp--preset--color--foreground, #000); box-shadow: 0 4px 15px rgba(0,0,0,0.05);\">\n    \n    <div style=\"margin-bottom: 20px;\">\n        <label style=\"display: block; margin-bottom: 8px; font-weight: 600;\">How many eggs are you ordering?<\/label>\n        <input type=\"number\" id=\"eggCount\" placeholder=\"Enter quantity\" min=\"1\" style=\"width: 100%; padding: 14px; border: 1px solid var(--wp--preset--color--foreground); border-radius: 6px; background: transparent; color: inherit; box-sizing: border-box;\">\n    <\/div>\n\n    <button onclick=\"calculateEggDelivery()\" style=\"width: 100%; padding: 16px; background-color: var(--wp--preset--color--primary); color: var(--wp--preset--color--background); border: none; border-radius: 6px; font-weight: bold; font-size: 1em; cursor: pointer; transition: opacity 0.2s;\">\n        Calculate Postage\n    <\/button>\n\n    <div id=\"eggResult\" style=\"margin-top: 25px; padding: 20px; border: 2px solid var(--wp--preset--color--primary); border-radius: 8px; display: none;\"><\/div>\n<\/div>\n\n<script>\nfunction calculateEggDelivery() {\n    const count = parseInt(document.getElementById('eggCount').value);\n    const resultDiv = document.getElementById('eggResult');\n    \n    if (isNaN(count) || count <= 0) {\n        alert(\"Please enter a valid number of eggs.\");\n        return;\n    }\n\n    let price = 0;\n    let tier = \"\";\n\n    \/\/ The Logic: \n    \/\/ Under 6 = \u00a35\n    \/\/ 7 - 24 = \u00a37\n    \/\/ 24+ = \u00a39\n    if (count <= 6) {\n        price = 5;\n        tier = \"Small Parcel (Up to 6 eggs)\";\n    } else if (count >= 7 && count <= 24) {\n        price = 7;\n        tier = \"Medium Parcel (7-24 eggs)\";\n    } else {\n        price = 9;\n        tier = \"Heavy Parcel (25+ eggs)\";\n    }\n\n    resultDiv.style.display = \"block\";\n    resultDiv.innerHTML = `\n        <div style=\"display: flex; justify-content: space-between; margin-bottom: 8px; opacity: 0.8; font-size: 0.9em;\">\n            <span>Package Size:<\/span>\n            <span>${tier}<\/span>\n        <\/div>\n        <div style=\"display: flex; justify-content: space-between; font-size: 1.3em; font-weight: 800; border-top: 1px solid var(--wp--preset--color--foreground); padding-top: 10px;\">\n            <span>Postage Cost:<\/span>\n            <span>\u00a3${price}.00<\/span>\n        <\/div>\n    `;\n}\n<\/script>\n\n\n\n<p class=\"wp-block-paragraph\">Our delivery fee covers fuel, vehicle maintenance, and the time taken for us to reach you safely.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To guarantee maximum freshness and secure delivery, all postal orders are dispatched via Royal Mail Tracked\u00ae 24.<\/p>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Local Delivery (Somerset Area) Postal Egg Delivery Enter Your Postcode Calculate Cost Mapping your route&#8230; How many eggs are you ordering? Calculate Postage Our delivery fee covers fuel, vehicle maintenance, and the time taken for us to reach you safely. To guarantee maximum freshness and secure delivery, all postal orders are dispatched via Royal Mail [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"page-with-title","meta":{"inline_featured_image":false,"footnotes":""},"class_list":["post-16","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/rosewoodmeadow.com\/index.php\/wp-json\/wp\/v2\/pages\/16","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rosewoodmeadow.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/rosewoodmeadow.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/rosewoodmeadow.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rosewoodmeadow.com\/index.php\/wp-json\/wp\/v2\/comments?post=16"}],"version-history":[{"count":1,"href":"https:\/\/rosewoodmeadow.com\/index.php\/wp-json\/wp\/v2\/pages\/16\/revisions"}],"predecessor-version":[{"id":17,"href":"https:\/\/rosewoodmeadow.com\/index.php\/wp-json\/wp\/v2\/pages\/16\/revisions\/17"}],"wp:attachment":[{"href":"https:\/\/rosewoodmeadow.com\/index.php\/wp-json\/wp\/v2\/media?parent=16"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}