WC_Shipping_Method::get_option()publicWC 1.0

Get_option function.

Gets and option from the settings API, using defaults if necessary to prevent undefined notices.

Method of the class: WC_Shipping_Method{}

Hooks from the method

Return

Mixed. The value specified for the option or a default value for the option.

Usage

$WC_Shipping_Method = new WC_Shipping_Method();
$WC_Shipping_Method->get_option( $key, $empty_value );
$key(string) (required)
Key.
$empty_value(mixed)
Empty value.
Default: null

WC_Shipping_Method::get_option() code WC 8.6.1

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;
}