Last active
November 19, 2020 19:06
-
-
Save CodeBrotha/908525b2472e35d2c4a851cadf38cb7b to your computer and use it in GitHub Desktop.
Hide Specific Shipping Rates From Shopify Checkout (Shopify Plus Stores Only)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% comment %} Hide Secret Shipping Rates From Checkout {% endcomment %} | |
<script type="text/javascript"> | |
if (Shopify.Checkout.step == 'shipping_method') { | |
$(window).load(function () { | |
$(".radio__label__primary").each(function () { | |
var shipMeth = $(this).data("shipping-method-label-title"); | |
if (shipMeth) { | |
if (shipMeth.includes("Name Of Secret Shipping Rate Here") || shipMeth.includes("Another Secret Ship Option Rate Here")) { | |
$(this).closest(".content-box__row").remove(); | |
$(".section__content").each(function () { | |
var firstRadio = $(this).find("input[name='checkout[shipping_rate][id]']").first(); | |
firstRadio.prop('checked', true); | |
}); | |
} | |
} | |
}); | |
}); | |
} | |
</script> | |
{% comment %} END Hide Secret Shipping Rates From Checkout {% endcomment %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment