Are PRs still supposed to be used for commerce_shipping? I notice a lot of patches in the queue, and no open PRs currently, so I wasn't sure the recommended way for me to proceed.

I ran into the following scenario:

I have a module which uses hook_commerce_shipping_methods_alter() to remove one of two shipping methods depending on what items are in the cart (whether they are all items for quote, or if there are also items for purchase in the cart).

If a user starts checkout one way, selects a shipping method, and then backs out to the cart and modifies their items such that the other shipping method is returned instead, there's an "illegal choice" error displayed on the page where you select the shipping method because the method's #default_value doesn't exist as an option.

Solving this in ShippingRateWidget only requires modifying one conditional slightly, and seems logical since if a method is altered out, there's no reason it should attempt to select that method in the form I don't think.

I'll have a patch available in a few minutes.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bmcclure created an issue. See original summary.

bmcclure’s picture

Status: Active » Needs review
FileSize
681 bytes

Here's the mentioned patch. Does this approach make sense?

  • bojanz committed 4afd81b on 8.x-2.x authored by bmcclure
    Issue #2872748 by bmcclure: Ensure default shipping method exists in...
bojanz’s picture

Status: Needs review » Fixed

Sounds good to me. Thanks.

(We're currently mostly using patches but I did setup https://github.com/drupalcommerce/commerce_shipping to start using Travis)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.