WC_Shipping_Method::get_option( string $key, mixed $empty_value = null )
Get_option function.
Description Description
Gets and option from the settings API, using defaults if necessary to prevent undefined notices.
Parameters Parameters
- $key
-
(Required) Key.
- $empty_value
-
(Optional) Empty value.
Default value: null
Return Return
(mixed) The value specified for the option or a default value for the option.
Source Source
File: includes/abstracts/abstract-wc-shipping-method.php
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() ) ) {
return $this->get_instance_option( $key, $empty_value );
}
// Return global option.
$option = apply_filters( 'woocommerce_shipping_' . $this->id . '_option', parent::get_option( $key, $empty_value ), $key, $this );
return $option;
}