Settings API empty value only used if set. In turn fixes blank values in flat rate shipping.

This commit is contained in:
Mike Jolley 2013-03-28 15:27:14 +00:00
parent 042af6051f
commit 6079c8f0e3
2 changed files with 3 additions and 2 deletions

View File

@ -137,7 +137,7 @@ abstract class WC_Settings_API {
* @param mixed $empty_value
* @return void
*/
public function get_option( $key, $empty_value = '' ) {
public function get_option( $key, $empty_value = null ) {
if ( empty( $this->settings ) )
$this->init_settings();
@ -147,7 +147,7 @@ abstract class WC_Settings_API {
$this->settings[ $key ] = isset( $this->form_fields[ $key ]['default'] ) ? $this->form_fields[ $key ]['default'] : '';
}
if ( empty( $this->settings[ $key ] ) )
if ( ! is_null( $empty_value ) && empty( $this->settings[ $key ] ) )
$this->settings[ $key ] = $empty_value;
return $this->settings[ $key ];

View File

@ -176,6 +176,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Fix - Fix the download method when force SSL is on.
* Fix - Put back sandbox pending fix. Aparently still needed for some accounts.
* Fix - Do not sanitize old attribute name to not mess up comparing
* Fix - Settings API empty value only used if set. In turn fixes blank values in flat rate shipping.
* Tweak - UX - Placeholder fades out on focus
* Tweak - UX - Only display validation result on required fields
* Localisation - NZ States