WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

WC_Gateway_COD::load_shipping_method_options() private WC 1.0

Loads all of the shipping method options for the enable_for_methods field.

{} Это метод класса: WC_Gateway_COD{}

Хуков нет.

Возвращает

Массив.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->load_shipping_method_options();

Код WC_Gateway_COD::load_shipping_method_options() WC 5.0.0

<?php
private function load_shipping_method_options() {
	// Since this is expensive, we only want to do it if we're actually on the settings page.
	if ( ! $this->is_accessing_settings() ) {
		return array();
	}

	$data_store = WC_Data_Store::load( 'shipping-zone' );
	$raw_zones  = $data_store->get_zones();

	foreach ( $raw_zones as $raw_zone ) {
		$zones[] = new WC_Shipping_Zone( $raw_zone );
	}

	$zones[] = new WC_Shipping_Zone( 0 );

	$options = array();
	foreach ( WC()->shipping()->load_shipping_methods() as $method ) {

		$options[ $method->get_method_title() ] = array();

		// Translators: %1$s shipping method name.
		$options[ $method->get_method_title() ][ $method->id ] = sprintf( __( 'Any &quot;%1$s&quot; method', 'woocommerce' ), $method->get_method_title() );

		foreach ( $zones as $zone ) {

			$shipping_method_instances = $zone->get_shipping_methods();

			foreach ( $shipping_method_instances as $shipping_method_instance_id => $shipping_method_instance ) {

				if ( $shipping_method_instance->id !== $method->id ) {
					continue;
				}

				$option_id = $shipping_method_instance->get_rate_id();

				// Translators: %1$s shipping method title, %2$s shipping method id.
				$option_instance_title = sprintf( __( '%1$s (#%2$s)', 'woocommerce' ), $shipping_method_instance->get_title(), $shipping_method_instance_id );

				// Translators: %1$s zone name, %2$s shipping method instance name.
				$option_title = sprintf( __( '%1$s &ndash; %2$s', 'woocommerce' ), $zone->get_id() ? $zone->get_zone_name() : __( 'Other locations', 'woocommerce' ), $option_instance_title );

				$options[ $method->get_method_title() ][ $option_id ] = $option_title;
			}
		}
	}

	return $options;
}