This pull request adds a new "Saves Zero Value?" option to the Money fieldtype, ensuring that a Price/Total field is always saved as £0.
Fixes #916.
Use Case
I have a case where I have an order blueprint where all the total fields are set as required (as per the default Simple Commerce blueprint).
However, commonly, not all the fields (like the Coupon Total) will actually be set due to the Money field being null/empty. This meant that when I go to save an entry in the orders collection, I can't because it requires the total fields to be some value.
History
From history, I've gone back on forward as to what the default should be here - whether it should always save £0 (which it should IMO) or whether it should save empty, like it does now.
There was an issue a while ago which prompted the change to the way it is now: #459
For now, the behaviour is opt-in (it'll continue to save empty but you can choose to let it save as £0). However, this will likely turn into being opt-out when v6 is released.
This pull request adds a new "Saves Zero Value?" option to the Money fieldtype, ensuring that a Price/Total field is always saved as £0.
Fixes #916.
Use Case
I have a case where I have an order blueprint where all the total fields are set as required (as per the default Simple Commerce blueprint).
However, commonly, not all the fields (like the Coupon Total) will actually be set due to the Money field being null/empty. This meant that when I go to save an entry in the orders collection, I can't because it requires the total fields to be some value.
History
From history, I've gone back on forward as to what the default should be here - whether it should always save £0 (which it should IMO) or whether it should save empty, like it does now.
There was an issue a while ago which prompted the change to the way it is now: #459
For now, the behaviour is opt-in (it'll continue to save empty but you can choose to let it save as £0). However, this will likely turn into being opt-out when v6 is released.