PR requested changes: shipping instance option filter moved to get_instance_option function, filters renamed.

This commit is contained in:
Martin Šnajdr 2019-02-27 17:31:51 +01:00
parent 1c678372d4
commit 4f9d47ea25
1 changed files with 5 additions and 5 deletions

View File

@ -462,13 +462,12 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
public function get_option( $key, $empty_value = null ) {
// Instance options take priority over global options.
if ( $this->instance_id && array_key_exists( $key, $this->get_instance_form_fields() ) ) {
$instance_option = apply_filters( 'woocommerce_shipping_' . $this->id . '_instance_option', $this->get_instance_option( $key, $empty_value ), $key, $empty_value, $this );
return $instance_option;
return $this->get_instance_option( $key, $empty_value );
}
// Return global option.
$global_option = apply_filters( 'woocommerce_shipping_' . $this->id . '_global_option', parent::get_option( $key, $empty_value ), $key, $empty_value, $this );
return $global_option;
$option = apply_filters( 'woocommerce_shipping_' . $this->id . '_option', parent::get_option( $key, $empty_value ), $key, $this );
return $option;
}
/**
@ -493,7 +492,8 @@ abstract class WC_Shipping_Method extends WC_Settings_API {
$this->instance_settings[ $key ] = $empty_value;
}
return $this->instance_settings[ $key ];
$instance_option = apply_filters( 'woocommerce_shipping_' . $this->id . '_instance_option', $this->instance_settings[ $key ], $key, $this );
return $instance_option;
}
/**