Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
We have price getters on the product (getPrice), line item (getUnitPrice, getTotalPrice), order (getTotalPrice), payment (getAmount, getRefundedAmount).
Each of these always returns a Price object. But the underlying field items can be empty, since Drupal entities don't need to be in a valid state when initialized or saved. If the field item is empty, then the getter should return NULL, not a Price object (because the Price object can't be valid, and because that's what other similar getters do).
Comments
Comment #2
bojanz CreditAttribution: bojanz at Centarro commentedComment #4
bojanz CreditAttribution: bojanz at Centarro commentedBoom.