Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Replace the shipping fees on a Classic storefront with a flat-rate shipping fee.
<!-- BEGIN Use flat-rate shipping. See -->
<script type="text/javascript">
// You configure this. Change 10.50 to your shipping rate. Please
// do not disturb the punctuation.
var flatRateShippingFee = 10.50;
document.addEventListener("DOMContentLoaded", function() {
if (RegExp('/shop/checkOut.jsp\\?storefront_KEY=').test(window.location.href)) {
var e = document.querySelector("#shipping");
if (e != null) {
e.value = flatRateShippingFee.toFixed(2);
e = document.querySelector("#sub");
var sub = parseFloat(e.value);
var total = (sub + flatRateShippingFee).toFixed(2);
document.querySelector("#amount").value = total;
document.querySelector("#amountDisplay").value = total;
<!-- END Use flat-rate shipping. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.