Closed (fixed)
Project:
Commerce Core
Version:
8.x-2.x-dev
Component:
Price
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
20 Sep 2017 at 11:15 UTC
Updated:
26 Feb 2018 at 20:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
sorabh.v6If any of amount, taxAmount or shippingAmount is null. Listbuilder class sends 'NA' for them. Please review the patch.
Comment #3
harings_rob commentedI think the issue here is that we have price getters returning NULL.
I believe the correct behaviour should be that the getters always return a price object. But this price object can be 0 (not null).
I have provided a pull request with this proposal.
https://github.com/drupalcommerce/commerce/pull/842
Comment #4
smccabe commentedAgree with Rob, the price should always be zero, so that math can be done on it, instead of null or N/A. I believe this patch is good to go, there are failing tests but those happen even without this patch. So this is either RTBC or wait for those patches other testing issues to be fixed. Marking as RTBC in the interest of progress and not bottlenecking.
Comment #5
harings_rob commentedThe errors are in fact regressions. This issue should also be moved to the drupal commerce queue.
Comment #6
harings_rob commentedComment #7
casey commentedThe documentation of the commerce_price_format filter contains an example: {{ order.getTotalPrice|commerce_price_format }}
If this should be possible, the filter should allow NULL values.
Comment #8
nikathoneThe patch is working for me. +1 for RTBC.
Comment #9
bojanz commentedI agree that formatPrice() should accept an empty value.
However, there is no need for an $empty_price_fallback, Twig already gives us the "default" filter we can use, like this:
I'll rework the patch.
Comment #11
bojanz commentedDone. Took the opportunity to clean up the tests as well. Thanks, everyone.