When I click the checkout button on the cart, I get a fatal PHP error.
The following message is added to the logs. Error: Call to a member function hasField() on bool in Drupal\commerce_donation_flow\Plugin\Commerce\CheckoutFlow\DonationCheckoutFlow->getSteps().
It appears that an item type of 'donation' is not included the order items. This causes the $donations array to be empty and consequently $donation is NULL rather than being an Order Item object. I'm unsure if this is a bug or if I'm misunderstanding how to use / configure the module.
I've configured the module following the steps outlined on the project page.
1. Donation flow I am using the configuration for Donation Flow checkout flow which was supplied by the module.
2. I am using the Default Order type and have configured it to use the Donation Flow checkout flow (screenshot 1)
3. Configure the Donation order item type. Set the order type configured above as the order type for Donation order items. (screenshot 2)
| Comment | File | Size | Author |
|---|---|---|---|
| screenshot 1 order type.png | 108.13 KB | peter caritas | |
| screenshot 2 donation order item.png | 83.33 KB | peter caritas |
Comments
Comment #2
fathershawnThanks for the report. I'll try to make time this week to have a close look
Comment #3
peter caritas commentedThanks for the quick reply. I re-ran on a clean install to make sure it wasn't a conflict with another module and I was able to replicate the issue.
Steps I took:
- Add any product to cart
- Go to cart and click the Checkout button
The error occurs when loading the first pane of the checkout process
I did try bypassing the donation item check in DonationCheckoutFlow->getSteps() and then it didn't throw the error, but I was taken directly to the payment pane and never had an opportunity to add a donation.
Hope that helps, please let me know if there's anything else I can do on my end.
Drupal 9.2.6
Commerce: 8.x-2.27
Commerce Donation Flow: 1.0.x-dev
PHP: 7.3.24
Comment #4
drakythe commentedI am having the same problem. My understanding is that a Product Variation Type should reference the Order Item Type in order for that order item type to end up on an order. However I cannot reference the Donation order item type on any existing or new product variation types. The only difference I can spot is that the Default order item type has a value in its "Purchasable entity type" field, while Donation order item type is set to "- None -" and cannot be edited.
Comment #5
fathershawnThe module having a custom checkout process causes confusion. I've added a configuration page to help with this in 1.1.x. The behaviors described are referring to the standard /cart to /checkout flow. I've also added an "add donation" pane for use in this standard flow.