diff --git a/CRM/Financial/BAO/Order.php b/CRM/Financial/BAO/Order.php index 9e84402c55b7..935403d1638d 100644 --- a/CRM/Financial/BAO/Order.php +++ b/CRM/Financial/BAO/Order.php @@ -793,12 +793,14 @@ protected function calculateLineItems(): array { } else { foreach ($this->getPriceOptions() as $fieldID => $valueID) { - $this->setPriceSetIDFromSelectedField($fieldID); - $throwAwayArray = []; - // @todo - still using getLine for now but better to bring it to this class & do a better job. - $newLines = CRM_Price_BAO_PriceSet::getLine($params, $throwAwayArray, $this->getPriceSetID(), $this->getPriceFieldSpec($fieldID), $fieldID)[1]; - foreach ($newLines as $newLine) { - $lineItems[$newLine['price_field_value_id']] = $newLine; + if ($valueID !== '') { + $this->setPriceSetIDFromSelectedField($fieldID); + $throwAwayArray = []; + // @todo - still using getLine for now but better to bring it to this class & do a better job. + $newLines = CRM_Price_BAO_PriceSet::getLine($params, $throwAwayArray, $this->getPriceSetID(), $this->getPriceFieldSpec($fieldID), $fieldID)[1]; + foreach ($newLines as $newLine) { + $lineItems[$newLine['price_field_value_id']] = $newLine; + } } } }