Drupal: 11.2.2
Commerce: 3.1.0
Commerce shipping pickup api: 1.0.2
Problem/Motivation
When I use a pickup shipping method what do not need to enter customer address i get the following error message:
Undefined array key "pickup_profile" in Drupal\commerce_shipping_pickup_api\Plugin\Commerce\CheckoutPane\PickupCapableShippingInformation->submitPaneForm() (line 409 of modules/contrib/commerce_shipping_pickup_api/src/Plugin/Commerce/CheckoutPane/PickupCapableShippingInformation.php).
Proposed resolution
line: $profile_name = $pane_form['pickup_profile'] ? 'pickup_profile' : 'shipping_profile';
change to: $profile_name = isset($pane_form['pickup_profile']) ? 'pickup_profile' : 'shipping_profile';
Issue fork commerce_shipping_pickup_api-3543321
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
anweshas commentedPicking this up, I’ll work on a patch/MR to address the undefined array key error.
Comment #3
djg_tram commentedThe first, quick idea is to change
$profile_name = $pane_form['pickup_profile'] ? 'pickup_profile' : 'shipping_profile';to
$profile_name = isset($pane_form['pickup_profile']) ? 'pickup_profile' : 'shipping_profile';Could you quickly try this? In my quick checks, this seems to be enough.
Comment #4
djg_tram commentedOops, I see, you wrote the same. :-)
I fixed this in the dev version, could you maybe test either that or your own fix to see whether this solves the problems? I did have to change quite a few things in the framework to accommodate submodules that need to ask for an address and have their own UI but it would be nice not to have a regression with those that don't.
Comment #5
mydot commentedThe new dev version is working now.
In the meantime i found an other bug what appeared with the 1.0.2 version. It shows up on the order shipment edit form:
Error: Call to a member function get() on null in Drupal\commerce_shipping_pickup_api\ProfileFieldCopyWithoutPickup->supportsForm() (line 25 of modules/contrib/commerce_shipping_pickup_api/src/ProfileFieldCopyWithoutPickup.php).
I would suggest to place two conditions after line $order = self::getOrder($form_state);
if (!$order) {
return FALSE;
}
if (!$order->hasField('shipments')) {
return FALSE;
}
Comment #6
djg_tram commentedIs it really possible to not get a valid order here? It sounds a bit strange... Anyway, I would suggest to leave the parent call even then and use
Comment #7
mydot commentedI tried it with your pickup store submodule too, with the same result. But Your suggestion is working.
Comment #8
djg_tram commentedPushed it to dev as well.
Comment #9
djg_tram commentedComment #10
mydot commentedThank You for the quick fix
Comment #11
djg_tram commented1.0.3 published.
Comment #12
djg_tram commentedComment #13
djg_tram commentedComment #14
anweshas commentedComment #15
anweshas commentedThanks for the quick follow-up and fixes. Confirming this is resolved in 1.0.3.