স্কিপ করে মূল কন্টেন্ট এ যান

ডিস্ট্রিক্ট আপডেট করলেই শিপিং লোকেশন আপডেট হয় যাবে

ডিস্ট্রিক্ট আপডেট করলেই শিপিং লোকেশন আপডেট হয় যাবে

১.ই-দোকান এর ম্যানেজ প্যানেল থেকে Shop > Design ক্লিক করুন

২.JvavScript অপশন এ ক্লিক করুন

৩.Add New তে ক্লিক করে একটা new javascript ফাইল ক্রিয়েট করুন ৪.জাভাস্ক্রিপ্ট এর কোড তা copy করে ওই খানে সেট করে আপডেট করুন

###Code

//Html
document.addEventListener("DOMContentLoaded", function () {
if (document.body.classList.contains('checkout-init')) {
let getDis = document.querySelector("#district");
let getShipping = document.querySelector("#shipping");

if (!getDis || !getShipping) return; // Prevent errors if elements are missing
const firstOption = getShipping.querySelector('option[value="Dhaka;70"]');
const secondOption = getShipping.querySelector('option[value="Outside Dhaka;130"]');

if (!firstOption || !secondOption) return; // Ensure options exist before modifying them

if (getDis.value.toLowerCase() === "dhaka") {
secondOption.classList.add("d-none");
secondOption.disabled = true; // Disable option
firstOption.classList.remove("d-none");
firstOption.disabled = false; // Enable option
getShipping.value = "Dhaka;70"; // Set default selection
} else {
firstOption.classList.add("d-none");
firstOption.disabled = true;
secondOption.classList.remove("d-none");
secondOption.disabled = false;
getShipping.value = "Outside Dhaka;130";
}

getDis.addEventListener('change', function () {
const firstOption = getShipping.querySelector('option[value="Dhaka;70"]');
const secondOption = getShipping.querySelector('option[value="Outside Dhaka;130"]');

if (!firstOption || !secondOption) return; // Ensure options exist before modifying them

if (getDis.value.toLowerCase() === "dhaka") {
secondOption.classList.add("d-none");
secondOption.disabled = true; // Disable option
firstOption.classList.remove("d-none");
firstOption.disabled = false; // Enable option
getShipping.value = "Dhaka;70"; // Set default selection
} else {
firstOption.classList.add("d-none");
firstOption.disabled = true;
secondOption.classList.remove("d-none");
secondOption.disabled = false;
getShipping.value = "Outside Dhaka;130";
}
});
}
});

</div>