I have set up a shipping discount function which applies a 100% shipping discount for “members” (users with a tag applied) on my shop. These members should only get to use this perk four times per year, which I’ll manage via a DB or metafield, no problems here. The tricky part is we want to allow members the option to opt-out of using one of their free shipping perks for whatever reason, let’s say on an especially small order. I have figured out how to use a Checkout UI extension above the shipping methods area to present this option, however, I cannot figure out how to somehow flag the order as waiving free shipping (REST call to the custom app perhaps?), nor can I figure out how I can go about making the shipping discount Function re-run. I’m hoping there is some straightforward way to do this, but have thought of a couple other ideas if not:
-
We could direct users wishing to waive free shipping to a profile page, where they could toggle off an option (metafield?) on their account, then return to the checkout. This flow redirection should re-trigger the checkout calculations.
-
We could create a dummy product called “Waive shipping” that we add or remove from the cart on the checkout page, which presumably would also re-trigger the calculations, but I have not tested this theory.
Would love to hear any other “clever” solutions if there really isn’t any other way to force a recalculation on the checkout page. Thanks in advance!