- Issue created by @olarin
- 🇮🇱Israel jsacksick
@Olarin: This would typically be handled by a
hook_form_alter()
or by swapping the shipping information pane.
Not really sure it makes sense to expose a setting for that as it's relatively easy to alter, and I'm not even sure where the setting would belong... If we start by exposing this error message, then what about the other strings accross Shipping or Commerce core itself? - 🇺🇸United States olarin
Fair point. I was looking at the OOP code and overthinking it and forgot about the good old standby option of a form_alter hook. Thanks for the reminder.
On further reflection, rather than just closing this, I'll change this to a low priority bug report rather than a feature request, since given that the module hides the radio buttons in this particular use case, instructing the user to make a selection they can't make is unhelpful. (Come to think of it this situation might also occur if you had multiple shipping options but none of them were valid for the address you entered, either because it was an invalid address or simply not covered by the available options.) There's only so much Commerce Shipping can do at this level to know what went wrong (for instance it can't necessarily discern why a shipping provider didn't respond with a useful quote for a particular request), but it should be able to at least differentiate between "the user didn't select an option" and "we couldn't give the user any options to select" and attempt to provide some slightly more helpful guidance in the latter case.
- 🇮🇱Israel jsacksick
Good point! Feel free to drop a patch here, I'd be happy to review it and get it in :).
- 🇩🇪Germany Anybody Porta Westfalica
@Olarin @jsacksick I think we fixed this in ✨ Use a theme function for rendering "there is no shipping rate" Needs review ?
Close as duplicate?
- 🇺🇸United States olarin
Hm, I think so. That ticket made the text configurable, and also made the default text a little more generic, rather than assuming (perhaps incorrectly) what went wrong, so it addresses the biggest concerns of this ticket, preventing a reasonable configuration (only one shipping option enabled) from resulting in misleading errors out of the box. If there was more we could do to differentiate between different problems and make it possible to give more specific, helpful error messages, that would be nice, but as I alluded to previously that's probably not possible unless shipping providers give us additional data as to why they returned no valid shipping options ("I can't ship to that address via these methods" vs. "I don't recognize that as a valid address").