Shopify functions not re-runing after hiding all shipping options

Shopify Partner
31 3 12

We setting up a custom app to limit the shipping options based on some rules (regex based) the function works great though I seem to have found a bug where once you hide all the shipping options you can't get them back without refreshing the page. When you try to change you address to a valid address the page still shows "No Shipping Options" until you refresh.


It works as expected if we switch the operation to `rename` changing any aspect of the address causes the function to rerun and reverts the name change if its not applicable. However when you send a `hide` operation the function appears to not get rerun when the address is changed. Checking in the Shopify Partners dashboard we can see that there are no function runs.

Theres really no way to report bugs to shopify... as this is not exactly a vulnerability it feels weird to post it in hackerone.


I realize that removing all shipping options may not be an intended use of the delivery customization, so were looking into the checkout/cart validation functions to see if that fits our needs better. Still this does appear to be a bug that should be fixed. And at this point its keeping us from migrating to the one page checkout.

Replies 2 (2)

Shopify Partner
31 3 12

Heres a simple function that will hide all shipping options in California

// @TS-check
* @typedef {import("../generated/api").RunInput} RunInput
* @typedef {import("../generated/api").FunctionRunResult} FunctionRunResult
* @typedef {import("../generated/api").Operation} Operation

* @param {RunInput} input
* @returns {FunctionRunResult}
export function run(input) {

    let toRemove = input.cart.deliveryGroups
          .filter((group) => {
            return group.deliveryAddress.provinceCode == "CA";
          .flatMap(group => group.deliveryOptions)
          .map(option => /** @type {Operation} */({
            hide: {
              deliveryOptionHandle: option.handle

    return {
      operations: toRemove


Shopify Partner
2 0 0

Also encountering this issue. We're trying to rebuild an old Checkout Scripts customisation with Functions. The goal was to hide all shipping options if the cart contains a product which is restricted in the destination country.

Initially, the function runs fine on all addresses, and reruns when the address is changed.
If you enter an address which meets the criteria, all shipping options are hidden as expected.
If you change address after deletion has triggered, the function doesn't rerun with no entries in partner dashboard, and no shipping options are available in checkout. (Doesn't matter if the new address has a completely different set of shipping methods to those which were hidden previously, they will still be unavailable)
If you refresh the page, shipping options will be available and the function behaves until deletion is triggered again.

Only seems to occur if all rates are hidden - so long as at least one rate is left unhidden, it seems to work as expected without any issues.


Also for what it's worth, as a test I made a function to delete payment methods with the same address-based criteria using payment customisation HideOperation.
This does not seem to suffer from the same issue and everything continues to run as normal even after it hides all payment methods.

I'm also going to attempt to swap this over to a validation function which I think makes sense for our goal anyway, but this does seem like a bug or flaw with delivery customisation functions.