WC_Shipping::get_shipping_method_class_names
Shipping methods register themselves by returning their main class name through the woocommerce_shipping_methods filter.
Метод класса: WC_Shipping{}
Хуки из метода
Возвращает
Массив.
Использование
$WC_Shipping = new WC_Shipping(); $WC_Shipping->get_shipping_method_class_names();
Код WC_Shipping::get_shipping_method_class_names() WC Shipping::get shipping method class names WC 10.4.3
public function get_shipping_method_class_names() {
// Unique Method ID => Method Class name.
$shipping_methods = array(
'flat_rate' => 'WC_Shipping_Flat_Rate',
'free_shipping' => 'WC_Shipping_Free_Shipping',
'local_pickup' => 'WC_Shipping_Local_Pickup',
);
// For backwards compatibility with 2.5.x we load any ENABLED legacy shipping methods here.
$maybe_load_legacy_methods = array( 'flat_rate', 'free_shipping', 'international_delivery', 'local_delivery', 'local_pickup' );
foreach ( $maybe_load_legacy_methods as $method ) {
$options = get_option( 'woocommerce_' . $method . '_settings' );
if ( $options && isset( $options['enabled'] ) && 'yes' === $options['enabled'] ) {
$shipping_methods[ 'legacy_' . $method ] = 'WC_Shipping_Legacy_' . $method;
}
}
return apply_filters( 'woocommerce_shipping_methods', $shipping_methods );
}