Automattic\WooCommerce\Internal\RestApi\Routes\V4\ShippingZones
ShippingZoneSchema::get_method_settings
Get raw method settings for frontend processing.
Метод класса: ShippingZoneSchema{}
Хуков нет.
Возвращает
array.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_method_settings( $method );
- $method(объект) (обязательный)
- Shipping method object.
Код ShippingZoneSchema::get_method_settings() ShippingZoneSchema::get method settings WC 11.2.2
protected function get_method_settings( $method ) {
$settings = array();
// Common settings that most methods have.
$common_fields = array( 'cost', 'min_amount', 'requires', 'class_cost', 'no_class_cost' );
foreach ( $common_fields as $field ) {
if ( isset( $method->$field ) ) {
$settings[ $field ] = $method->$field;
}
}
// Return all available settings for maximum flexibility.
if ( isset( $method->instance_settings ) && is_array( $method->instance_settings ) ) {
$settings = array_merge( $settings, $method->instance_settings );
}
return $settings;
}