0

this is the error TypeError: Return value of CRM_Financial_BAO_Order::getDefaultPriceFieldID() must be of the type int, null returned in CRM_Financial_BAO_Order->getDefaultPriceFieldID() (line 671 of /www/sites/all/modules/civicrm/CRM/Financial/BAO/Order.php any idea how to fix would be greatly appreciated

1
  • Drupal 7 civicrm 5.47.3 if that matters
    – Yos
    Commented Apr 4, 2022 at 14:03

1 Answer 1

2

This is because your system has a line item with a missing price field or price field value.

Run the below query to find if there are line items with a missing price field or price field value.

SELECT COUNT(*) FROM civicrm_line_item
WHERE price_field_id IS NULL OR price_field_value_id IS NULL;

If the count is more than 0 after running above query then run the below query

SELECT @price_field_id := cpf.id, @price_field_value_id := cpfv.id
FROM civicrm_price_field_value cpfv
  INNER JOIN civicrm_price_field cpf
    ON cpf.id = cpfv.price_field_id
  INNER JOIN civicrm_price_set cps
    ON cps.id = cpf.price_set_id
      AND cps.name = 'default_contribution_amount';

 UPDATE civicrm_line_item 
 SET price_field_id = @price_field_id
 WHERE price_field_id IS NULL;

 UPDATE civicrm_line_item 
 SET price_field_value_id = @price_field_value_id
 WHERE price_field_value_id IS NULL;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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