When using the checkout progress block and custom views page with path e.g. checkout/%commerce_order/order_information/%user/select-address
there can be error like
TypeError: Drupal\commerce_checkout\CheckoutOrderManager::getCheckoutFlow(): Argument #1 ($order) must be of type Drupal\commerce_order\Entity\OrderInterface, string given, called in /app/web/modules/contrib/commerce/modules/checkout/src/Plugin/Block/CheckoutProgressBlock.php on line 83 in Drupal\commerce_checkout\CheckoutOrderManager->getCheckoutFlow() (line 33 of /app/web/modules/contrib/commerce/modules/checkout/src/CheckoutOrderManager.php)
I remember we had similar error in CommerceOrderHooks::menuLocalTasksAlter() on views pages, so maybe it would be good idea to add similar fix e.g. loading an order if $this->routeMatch->getParameter('commerce_order'); returns string value.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | commerce-3591608-3.patch | 2.82 KB | khiminrm |
Issue fork commerce-3591608
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 #3
khiminrm commentedPatch from the PR
Comment #4
khiminrm commentedComment #5
jsacksick commentedThis doesn't look like a proper change... The right fix here IMO is to write a route subscriber altering the route defined by views and set the parameter type.
If this breaks, it could break in other places in the code...
Please try that approach first, and let me know if it helped.
Comment #7
tbkot commented@jsacksick I've added the route subscriber to add types for the route property if the property is the commerce entity. It works well, but I would still keep the changes made by Roman, just in case there is a custom route without a defined property type.
I've added some fixes there, so tests are passing
Comment #9
jsacksick commented