Thanks for the help, everyone (including a host of people on other threads which go back some years!).
For those of you who are interested - and who may have similar situations regarding "unconventional" shipping, the above code was needed to disable the flat rate module, when sufficient items were in the cart, at which point FREE SHIPPING applies.
My client charges a flat delivery rate for up to 4 items. They also wanted an ALERT to appear during the checkout process, and on the shipping estimator, which appears when there are LESS than 5 items in the cart.
This alert advises the shopper that FREE shipping will apply if at least 5 items are bought, and invites them to continue shopping.
Now, the alert is also conditional. If there are 5 or more items, then the alert must not display.
And of course, if there are 5 or more items, the flat rate module must disappear, and a free shipping module must appear.
It can all be viewed at https://www.planscapedirect.co.uk and you don't need to go as far as registering as a customer - just pop some items into the cart and check out shipping estimator. Toggle with a total cart of less than 5 items, and then more than 5 items.
If anyone is looking to do something similar, join this thread and I'll see if I can help.