WC_Admin_Setup_Wizard::shipping_method_selection_form() protected WC 1.0
Устарела с версии 4.6.0. Больше не поддерживается и может быть удалена. Рекомендуется заменить эту функцию на аналог.╳
Render the available shipping methods for a given country code.
{} Это метод класса: WC_Admin_Setup_Wizard{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->shipping_method_selection_form( $country_code, $currency_code, $input_prefix );
- $country_code(строка) (обязательный)
- Country code.
- $currency_code(строка) (обязательный)
- Currency code.
- $input_prefix(строка) (обязательный)
- Input prefix.
Список изменений
Устарела с | 4.6.0 |
Код WC_Admin_Setup_Wizard::shipping_method_selection_form() WC Admin Setup Wizard::shipping method selection form WC 5.0.0
protected function shipping_method_selection_form( $country_code, $currency_code, $input_prefix ) {
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
$selected = 'flat_rate';
$shipping_methods = $this->get_wizard_shipping_methods( $country_code, $currency_code );
?>
<div class="wc-wizard-shipping-method-select">
<div class="wc-wizard-shipping-method-dropdown">
<select
id="<?php echo esc_attr( "{$input_prefix}[method]" ); ?>"
name="<?php echo esc_attr( "{$input_prefix}[method]" ); ?>"
class="method wc-enhanced-select"
data-plugins="<?php echo wc_esc_json( wp_json_encode( $this->get_wcs_requisite_plugins() ) ); ?>"
>
<?php foreach ( $shipping_methods as $method_id => $method ) : ?>
<option value="<?php echo esc_attr( $method_id ); ?>" <?php selected( $selected, $method_id ); ?>><?php echo esc_html( $method['name'] ); ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="shipping-method-descriptions">
<?php foreach ( $shipping_methods as $method_id => $method ) : ?>
<p class="shipping-method-description <?php echo esc_attr( $method_id ); ?> <?php echo $method_id !== $selected ? 'hide' : ''; ?>">
<?php echo esc_html( $method['description'] ); ?>
</p>
<?php endforeach; ?>
</div>
</div>
<div class="shipping-method-settings">
<?php foreach ( $shipping_methods as $method_id => $method ) : ?>
<?php
if ( empty( $method['settings'] ) ) {
continue;
}
?>
<div class="shipping-method-setting <?php echo esc_attr( $method_id ); ?> <?php echo $method_id !== $selected ? 'hide' : ''; ?>">
<?php foreach ( $method['settings'] as $setting_id => $setting ) : ?>
<?php $method_setting_id = "{$input_prefix}[{$method_id}][{$setting_id}]"; ?>
<input
type="<?php echo esc_attr( $setting['type'] ); ?>"
placeholder="<?php echo esc_attr( $setting['default_value'] ); ?>"
id="<?php echo esc_attr( $method_setting_id ); ?>"
name="<?php echo esc_attr( $method_setting_id ); ?>"
class="<?php echo esc_attr( $setting['required'] ? 'shipping-method-required-field' : '' ); ?>"
<?php echo ( $method_id === $selected && $setting['required'] ) ? 'required' : ''; ?>
/>
<p class="description">
<?php echo esc_html( $setting['description'] ); ?>
</p>
<?php endforeach; ?>
</div>
<?php endforeach; ?>
</div>
<?php
}