Skip to content

Instantly share code, notes, and snippets.

@CodeBrotha
Last active November 19, 2020 19:06
Show Gist options
  • Save CodeBrotha/908525b2472e35d2c4a851cadf38cb7b to your computer and use it in GitHub Desktop.
Save CodeBrotha/908525b2472e35d2c4a851cadf38cb7b to your computer and use it in GitHub Desktop.
Hide Specific Shipping Rates From Shopify Checkout (Shopify Plus Stores Only)
{% 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