WordPress at Your Fingertips
function is not described

WC_Settings_API::get_option() public WC 1.0

Get option from DB.

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

{} It's a method of the class: WC_Settings_API{}

No Hooks.

Return

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

Usage

$WC_Settings_API = new WC_Settings_API();
$WC_Settings_API->get_option( $key, $empty_value );
$key(string) (required)
Option key.
$empty_value(mixed)
Value when empty.

Code of WC_Settings_API::get_option() WC 5.5.2

<?php
public function get_option( $key, $empty_value = null ) {
	if ( empty( $this->settings ) ) {
		$this->init_settings();
	}

	// Get option default if unset.
	if ( ! isset( $this->settings[ $key ] ) ) {
		$form_fields            = $this->get_form_fields();
		$this->settings[ $key ] = isset( $form_fields[ $key ] ) ? $this->get_field_default( $form_fields[ $key ] ) : '';
	}

	if ( ! is_null( $empty_value ) && '' === $this->settings[ $key ] ) {
		$this->settings[ $key ] = $empty_value;
	}

	return $this->settings[ $key ];
}