I am trying to hide certain delivery options in checkout with deliveryOptionHide, the delivery option gets hidden but stays selected if the customer backs out from checkout and enters it again. The correct displayed options gets selected after the form is updated or page refreshed.
Currently I am somewhat following the functions tutorial and I’m hiding delivery options if the cart price is over a certain amount (for debugging right now). The options get hidden but the previous selection from the last checkout session is still selected, this results in radio button for Shipping method not being selected. (and sometimes the total cart price was incorrect from the previous shipping method but I cannot reproduce that right now)
When the checkout form gets updated, the radio button selects by itself. When the page is then refreshed, it also displays without the radio button.
Is this just a limitation or should this not be happening?
export function cartDeliveryOptionsTransformRun(input)
{
let options = input.cart.deliveryGroups
.flatMap(group => group.deliveryOptions)
/** @type {Operation[]} */
let toHide = options
.filter(option => input.cart.cost.totalAmount.amount > 1000 && option.title != "Standard")
.map(option => /** @type {Operation} */({
deliveryOptionHide: {
deliveryOptionHandle: option.handle
}
}));
return {
operations: toHide
};
};

