The table "civicrm_line_item" has a field called "contribution_id". For the most part, this field is filled in. But there are many records where the "contribution_id" field is NULL. I have seen this with happen no matter what the "entity_table" value is.

Why is "contribution_id sometimes NULL? What would cause this? (I have seen this in version 4.5.x and version 4.6.5)

  • I've noticed this when importing participants/memberships. Could it be the same thing that you're seeing? – Nicholai Jul 29 '15 at 13:29

For every contribution, a line_item is being created. The contribution_id field is the FK reference to the civicrm_contribution table.

If I manually delete the Contribution record related to the Contact, the contribution gets deleted from civicrm_contribution table, which results in contribution_id to be NULL in civicrm_line_item.

| improve this answer | |
  • I would have thought that if a contribution is deleted the line items linked to it should also been deleted. – JoAnne Jul 30 '15 at 13:54
  • @JoAnne - I believe the line items aren't deleted for auditing/bookkeeping reasons. I could be wrong! – Jon G - Megaphone Tech Aug 29 '15 at 17:13

Here's one context where a civicrm_line_item record is created with contribution_id NULL:
Line Items should be created for all Membership Signup/Renewal and Participant Registration transactions

See also:
Line item for membership entity should be created even when Record Payment is not checked

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.