Alter method of getting the donation item

Created on 15 October 2021, about 3 years ago
Updated 3 September 2023, about 1 year ago

Problem/Motivation

If a donation item is not present on the order, then DonationItemPaneBase chokes. I don't know whether or not this would be an issue in the provided donation checkout flow, but it's likely that you could encounter a situation where the donation pane is present on a custom checkout flow with an optional donation for an order without a donation item.

This may be related to https://www.drupal.org/project/commerce_donation_flow/issues/3239498 πŸ› Error: Call to a member function hasField() on bool Closed: works as designed . Don't know whether you want to roll these together or not. I think the issue of operating on a null/missing donationItem could be fairly omnipresent given the initial intended use case of the module.

Proposed resolution

Attaching a very simple patch that just returns an empty array if a donation item isn't present, which essentially just results in no markup being rendered for the pane.

πŸ› Bug report
Status

Fixed

Version

1.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mrweiner

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024