Very simple use case, using only flat rate shipping, with version 2 of Drupal Commerce Shipping and Drupal Commerce Flat Rate. I have two shipping options customers can choose between if they are in one country (the UK) and two if they're in any other country. Let's call them:
- UK standard
- UK special
- International standard
- International special
I've looked for ways to switch shipping rates on and off using rules, but all I can find is rules that apply a particular shipping rate, not rules which enable or disable options that the customer can then choose between.
This related question gives a faint outline of how to apply rates, but not how to enable or disable options, and likewise this related question, where there are 12 options but all are chosen for the customer (and the answers simply say "use rules"). Under the Calculation Rules tab under admin/commerce/config/shipping/services/flat-rate
, I can't see anything in the "actions" list that looks like it enables or disables a particular rate. Plenty that appear to apply a rate, but not giving the customer a choice or limiting the choice.
This is clearly common and possible, as it's referred to for example in this issue, but I can't find anything on how to do it.
I've tried adding a rule like this through "Configure component" for a particular shipping rate, but it had no effect, the international rate still appears as an option even if the country is "United Kingdom". Here's the rule:
Here's another I tried using "Calculation rules" which, also had no effect:
Everything I can find around enabling or disabling shipping by country is about disabling countries completely.
I couldn't find anything in the Commerce Shipping documentation, and there is no Flat Rate documentation.